# DotNetWpfInstaller **Repository Path**: kakil0/dot-net-wpf-installer ## Basic Information - **Project Name**: DotNetWpfInstaller - **Description**: No description available - **Primary Language**: C# - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-19 - **Last Updated**: 2025-12-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 跨 .NET 平台的 WPF Manifest 驱动安装器 一个现代化的、基于 Manifest 驱动的 Windows 应用程序安装器,使用 WPF 和 .NET 8 构建。 ## 🚀 特性 ### 核心功能 - **Manifest 驱动**: 基于 JSON 配置文件的灵活安装流程 - **现代化 UI**: 美观的 WPF 界面,支持自定义主题 - **多语言支持**: 内置中英文本地化,可扩展其他语言 - **安全模型**: 文件完整性验证、数字签名检查 - **跨平台兼容**: 支持 .NET Framework 和 .NET 8+ 运行时 ### 安装流程 1. **欢迎页面**: 显示应用信息和系统要求 2. **许可协议**: 用户协议确认 3. **安装选项**: 路径选择和组件配置 4. **安装进度**: 实时进度显示和日志 5. **完成页面**: 安装结果和后续操作 ## 🛠️ 技术架构 ### 项目结构 ``` src/InstallerApp/ ├── Models/ # 数据模型 │ └── InstallManifest.cs ├── Services/ # 核心服务 │ ├── ManifestParser.cs │ ├── InstallEngine.cs │ └── LocalizationService.cs ├── Pages/ # UI 页面 │ ├── WelcomePage.xaml │ ├── EulaPage.xaml │ ├── OptionsPage.xaml │ ├── InstallPage.xaml │ ├── CompletePage.xaml │ └── Styles.xaml └── Resources/ # 资源文件 └── Localization/ ``` ### 核心组件 #### Manifest 解析器 (ManifestParser) - 解析 JSON 格式的安装配置 - 验证 Manifest 结构和完整性 - 支持条件安装和依赖检查 #### 安装引擎 (InstallEngine) - 文件复制和解压缩 - 注册表操作 - 快捷方式创建 - 服务安装和配置 #### 本地化服务 (LocalizationService) - 动态语言切换 - 资源文件管理 - 文化特定格式化 ## 📋 Manifest 格式 ```json { "schemaVersion": "0.1", "metadata": { "id": "com.example.app", "name": "TMS", "version": "1.0.0", "publisher": "KOMEG", "description": "这是一个TMS的安装包", "homepage": "https://example.com", "supportUrl": "https://example.com/support" }, "requirements": { "os": { "platform": "windows", "minVersion": "10.0.0" }, "runtime": { "dotnet": { "version": "8.0", "required": true } }, "hardware": { "minMemoryMB": 512, "minDiskSpaceMB": 100 } }, "installation": { "defaultPath": "%ProgramFiles%\\ExampleApp", "allowCustomPath": true, "components": [ { "id": "core", "name": "核心文件", "required": true, "files": [ { "source": "app/ExampleApp.exe", "destination": "ExampleApp.exe" } ] } ] } } ``` ## 🚀 快速开始 ### 环境要求 - .NET 8.0 SDK 或更高版本 - Windows 10/11 (开发和运行) - Visual Studio 2022 或 VS Code (推荐) ### 构建项目 #### 开发构建 ```powershell cd src/InstallerApp dotnet build dotnet run ``` #### 发布构建 ```powershell # 使用构建脚本 (推荐) .\build.ps1 -Runtime win-x64 -SingleFile # 或手动构建 dotnet publish src/InstallerApp -c Release -r win-x64 --self-contained -p:PublishSingleFile=true -o dist/win-x64 ``` ### 创建安装包 1. 准备应用文件和 Manifest 2. 使用构建脚本生成安装器 3. 测试安装流程 4. 可选:代码签名 ## 🔧 配置选项 ### 构建参数 - `Configuration`: Debug/Release - `Runtime`: win-x64, win-x86, win-arm64 - `SelfContained`: 是否包含运行时 - `SingleFile`: 是否打包为单文件 ### 本地化 支持的语言: - 中文 (zh-CN) - 默认 - 英文 (en-US) 添加新语言: 1. 在 `LocalizationService.cs` 中添加翻译 2. 更新语言检测逻辑 3. 测试 UI 布局 ## 📖 使用指南 ### 基本用法 1. 双击运行安装器 2. 按照向导完成安装 3. 检查安装日志 ### 高级用法 ```cmd # 静默安装 InstallerApp.exe /S /D=C:\MyApp # 指定 Manifest InstallerApp.exe /MANIFEST=custom.json # 启用详细日志 InstallerApp.exe /LOG=install.log /VERBOSE ``` ## 🤝 贡献指南 1. Fork 项目 2. 创建特性分支 (`git checkout -b feature/AmazingFeature`) 3. 提交更改 (`git commit -m 'Add some AmazingFeature'`) 4. 推送到分支 (`git push origin feature/AmazingFeature`) 5. 打开 Pull Request ## 📄 许可证 本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情。 ## 🙏 致谢 - .NET 团队提供的优秀框架 - WPF 社区的设计灵感 - 所有贡献者的支持 ## 📞 支持 如有问题或建议,请: - 提交 [Issue](https://github.com/your-repo/issues) - 发送邮件至 support@example.com - 查看 [Wiki](https://github.com/your-repo/wiki) 文档 --- **注意**: 这是一个示例项目,用于演示 WPF 安装器的实现方案。在生产环境中使用前,请进行充分的测试和安全审查。