打包流程可以参考package tools.
驱动安装流程可以参考windows driver install.
桌面软件开发可以参考ui.
Wix的基本使用和驱动基本信息可以参考name.
cmake.exe -- 编译工具,执行cmake指令相关的指令发出者
cmcldeps.exe -- 依赖管理工具
cpack.exe -- 打包工具,执行cpack打包输出相关指令发出者
ctest.exe -- 测试工具,执行ctest测试相关指令发出者
cmake-gui.exe: -- cmake图形化工具集
7Z = 7-Zip file format
DEB = Debian packages
External = CPack External packages
IFW = Qt Installer Framework
INNOSETUP = Inno Setup packages
NSIS = Null Soft Installer
NSIS64 = Null Soft Installer (64-bit)
NuGet = NuGet packages
STGZ = Self extracting Tar GZip compression
TBZ2 = Tar BZip2 compression
TGZ = Tar GZip compression
TXZ = Tar XZ compression
TZ = Tar Compress compression
TZST = Tar Zstandard compression
WIX = MSI file format via WiX tools
ZIP = ZIP file format
# dependences
# https://www.cnblogs.com/xujiecnblogs/p/17285824.html
# https://blog.csdn.net/qq_41750806/article/details/122166802
# https://learn.microsoft.com/zh-cn/dotnet/framework/deployment/deployment-guide-for-developers
# https://learn.microsoft.com/zh-cn/visualstudio/extensibility/internals/installing-vspackages-with-windows-installer?view=vs-2022
.msi -- WiX Toolset
.msix -- MSIX Packaging Tool
.exe -- Qt Installer Framework
.cab -- IExpress
.exe -- Installshield
.exe -- Inno Setup
.msi/.exe -- Advanced Installer
# https://blog.csdn.net/huanggang982/article/details/106347683
devcon.exe -- windows设备控制台,设备驱动的CLI工具
difxcmd.exe -- 可以使用脚本指令安装程序,也可以使用库安装驱动difxapi.lib: DriverPackageInstall
dpinst -- 使用静默方式安装不了驱动,必须要有交互UI
PnPUtil -- 从驱动程序存储区(C:\Windows\System32\DriverStore\FileRepository)中删除驱动和预安装驱动
# 获取安装前后的oemxx.inf的差别
@echo off
pnputil /enum-drivers > driverlist_before.txt
pnputil /add-driver *.inf /install
pnputil /enum-drivers > driverlist_after.txt
fc driverlist_after.txt driverlist_before.txt | findstr /C:"oem" > diff.txt
# 微软应用开发框架功能比较: https://learn.microsoft.com/zh-cn/windows/apps/get-started/?tabs=cpp-win32%2Cnet-maui#app-development-framework-feature-comparison
# nvidia-smi: https://blog.csdn.net/FL1623863129/article/details/135959774
# js/ts调用c/c++: https://zhuanlan.zhihu.com/p/477093164
# Electron使用示例: https://github.com/hokein/electron-sample-apps
# flutter示例: https://github.com/iampawan/FlutterExampleApps
# wxwidgets教程: https://iteb-ccpp.flygon.net/#/docs/wx-xplat-gui-prog/README
# wxwidgets示例: https://github.com/gammasoft71/Examples_wxWidgets.git
WPF/UWP -- windows原生的C# XAML UI,但不支持跨平台
vue.js+asp.net Core -- vue.js作为前端,使用asp.net Core作为后端跨平台开发
Avalonia -- .NET开发支持C#和F#跨平台,不支持c#和c/c++混编,但是支持P/Invoke调用,及windows支持C++/CLI封装本地类
Tauri, Iced, egui -- Rust GUI框架, 体积小, 依赖少
Qt -- C++ GUI框架, 示例丰富, 但商用收费高
Electron -- ts/js Web框架, 体积大, 性能优化比较难
flutter -- Dart框架, 成熟, 跨平台渲染快, 移动端的王
wxwidgets -- C++ GUI框架, 体积小性能高, 但官方支持示例较少
# webview架构gui
rust + webview = tauri -- https://github.com/tauri-apps/tauri.git
python + webview = pywebview -- https://github.com/r0x0r/pywebview.git
golang + webview = wails -- https://github.com/wailsapp/wails.git
bun + webview = webview_bun -- https://github.com/tr1ckydev/webview-bun.git
node.js + webview = webview-nodejs -- https://github.com/Winterreisender/webview-nodejs.git
ruby + webview = WebviewRuby -- https://github.com/Maaarcocr/webview_ruby.git
c/c++ : webview -- https://github.com/webview/webview.git
java : webview_java -- https://github.com/webview/webview_java.git
lua + webview = lua-webview -- https://github.com/javalikescript/lua-webview.git
dart + webview = webview_dart -- https://github.com/shreyassanthu77/webview_dart.git
# DriverStoreExplorer: https://github.com/lostindark/DriverStoreExplorer.git
# DriverLoader: https://github.com/hanjunjun/DriverLoader.git
# DriverTool: https://github.com/dybb8999/DriverTool.git
# WindowsToolbox: https://github.com/Gaoyifei1011/WindowsToolbox.git
# awesome-media-player: https://github.com/bluday/awesome-media-player.git
xdl_npu_driver
XDL NPU Driver
XDL Technologies Inc.
https://www.azurengine.cn
# wix toolset: https://github.com/wixtoolset/wix.git
# wix toolset discussion: https://github.com/orgs/wixtoolset/discussions
# wixsharp: https://github.com/oleg-shilo/wixsharp.git
# 快速上手: https://docs.firegiant.com/quick-start/
# 如何制作组件: https://docs.firegiant.com/wix3/howtos/
# Wix v4学习博客网站: https://blog.csdn.net/grade_one_forever/article/details/89254143
# Wix V3学习博客网站: https://www.cnblogs.com/stoneniqiu/category/522235.html
# 微软Windows installer网站: https://learn.microsoft.com/zh-cn/windows/win32/msi/windows-installer-portal
# cmake Wix V3: https://github.com/apriorit/FindWiX.git
# 打包驱动的个人示例: https://www.codeleading.com/article/24122300404/
# Wix V4 newer示例库: https://github.com/stephenlepisto/wixtoolsetexamples
# Wix V3示例库: https://github.com/kurtanr/WiXInstallerExamples
# DIFx废弃: https://learn.microsoft.com/en-us/previous-versions/windows/drivers/install/difx-guidelines
# HeatWave for VS2022拓展安装 --> 打开visual studio 2022 --> Extension --> Manage Extension --> 搜索HeatWave for VS2022 --> 安装
# 安装教程: https://blog.csdn.net/m0_58648890/article/details/144443321
# 基本教程: https://blog.walterlv.com/post/getting-started-with-wix-toolset.html
wix.exe -h
wix.exe --version
dotnet -h
dotnet --info
dotnet --list-sdks
dotnet tool install --global wix
dotnet tool update --global wix
# build默认debug
dotnet build
dotnet build --configuration Release
# install
msiexec /i bin\Debug\QuickStart.msi /l*v install_log.txt
# uninstall
msiexec /x bin\Debug\QuickStart.msi /l*v uninstall_log.txt
# debug
MsiExec /L*V "installation.log" /i "rpp_drv_package.msi"
WiX通过使用XML来描述组件、功能和XML格式的.MSI文件中使用的各种对话框。 通过标签<Package> <Feature> <Component> <Component>
<File> <Shortcut> <RegistryValue> <Directory> <StandardDirectory>安装产品的目录布局。
技术点: XML语法,WiX toolset模块及API的使用,项目模块拓展等。
项目结构。
# 新项目文件结构
# .wxs, for WiX Source file.
# .wxl, for WiX Localization file.
Package.wxs
Folders.wxs
ExampleComponents.wxs
Package.en-us.wxl
Package.wxs WiX源文件结构。
<!-- Package.wxs, 根元素Wix,命名空间http://wixtoolset.org/schemas/v4/wxs -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"></Wix>
<!--
Name: package name.
Manufacturer: company name.
Version(16bit x 4): major.minor.build.patch major.minor.build major minor
UpgradeCode: GUID(会被隐藏)
-->
<Package Id="TODO_Manufacturer.rpp_drv_package" Name="WixTutorialPackage" Manufacturer="TODO Manufacturer" Version="1.0.0.0" UpgradeCode="d73bcdbd-ee6b-4e71-a49f-ad33b96944a3"></Package>
<!-- 降级时打印的错误信息,阻止降级 -->
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
<!-- 功能入口 -->
<Feature Id="Main"></Feature>
<!-- 组件引用组 -->
<ComponentGroupRef Id="ExampleComponents" />
Folders.wxs WiX源文件结构。
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"></Wix>
<!-- 声明WiX的一个片段 -->
<Fragment></Fragment>
<!--
Windows安装的标准目录
A Windows Installer standard directory.
对于32bit的MSI包,ProgramFiles6432Folder被解析为C:\Program Files (x86)
对于64bit的MSI包,ProgramFiles6432Folder被解析为C:\Program Files
-->
<StandardDirectory Id="ProgramFiles6432Folder"></StandardDirectory>
<!--
其中!是取值的意思
bind.Property.Manufacturer获取的是Package.wxs中的Manufacturer
bind.Property.ProductName获取的是Package.wxs中的name
-->
<Directory Id="INSTALLFOLDER" Name="!(bind.Property.Manufacturer) !(bind.Property.ProductName)" />
ExampleComponents.wxs WiX源文件结构。
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"></Wix>
<Fragment></Fragment>
<!-- 作为一个组件,被Package.wxs引用 -->
<ComponentGroup Id="ExampleComponents" Directory="INSTALLFOLDER"></ComponentGroup>
<!-- 组件引用的文件 -->
<Component><File Source="ExampleComponents.wxs" /></Component>
Package.en-us.wxl WiX本地化文件。
<!-- Culture: 语言和地区 -->
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"></WixLocalization>
<!-- 在Package.wxs中被本地化引用!(loc.DowngradeError)按照机器翻译成en-US de-DE ja-JP tlh -->
<String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
实战步骤。
# 1. Create the app project.
在同一个solution下,创建一个项目c/c++/c#,写一个helloworld程序
# 2. Add a project reference.
WixTutorialPackage项目下的Dependencies --> 右键 --> Add Project Reference. --> 选中新建的项目
# 3. Replace placeholder component with app.exe.
将ExampleComponents.wxs引用的<File Source="ExampleComponents.wxs" />文件ExampleComponents.wxs --> helloworld.exe
# 4. Rename ExampleComponents to AppComponents.
ExampleComponents.wxs组件名变更id为<ComponentGroup Id="AppComponents" Directory="INSTALLFOLDER">
Package.wxs引用组件id也同步变更<ComponentGroupRef Id="AppComponents" />
# 5. Fix our company name.
Package.wxs中的<Package></Package>名称版本修改即可
# 6. 表达式和判断
=和== 都是等于判断
<>和!= ~= NOT都是不等于,但<>需要转义<>
< 大于,转义<
> 小于,转义>
& 与,转义&
MsiNTProductType != 1 --> MsiNTProductType <> 1
表达式和判断。
<!-- 1. 判断平台和赋值 -->
<?if $(var.Platform)=x86?>
<?define ProgramFilesFolder="ProgramFilesFolder" ?>
<?define Win64="no" ?>
<?define Arch="(x86)" ?>
<?else?>
<?define ProgramFilesFolder="ProgramFiles64Folder" ?>
<?define Win64="yes" ?>
<?define Arch="(x64)" ?>
<?endif?>
<!-- 2. 判断和打印 -->
<Launch Condition="MsiNTProductType = 1" Message="TODO Wrong OS type! TODO" />
<!-- 3. InstallExecuteSequence是一个action执行序列
在安装或卸载的过程中会执行这些action,我们可以使用Before或After命名空间在这些action直接插入custom action
-->
• AppSearch
• LaunchConditions
• ValidateProductId
• CostInitialize
• FileCost
• CostFinalize
• InstallValidate
• InstallInitialize
• ProcessComponents
• UnpublishFeatures
• RemoveRegistryValues
• RemoveShortcuts
• RemoveFiles
• InstallFiles
• CreateShortcuts
• WriteRegistryValues
• RegisterUser
• RegisterProduct
• PublishFeatures
• PublishProduct
• InstallFinalize
WiX扩展使用。
# 引用拓展来源: https://www.nuget.org/packages?q=wixtoolset+wixext
# 1. Needing a WiX extension
# 2. Adding the WiX extension to our project
WixTutorialPackage项目 --> 右键 --> Manage NuGet Packages --> Browse搜索wixext --> 右上角安装 --> apply
# 3. Adding the WiX extension namespace to our code
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"></Wix>
# 4. Invoking the WiX extension
<util:QueryNativeMachine />获取WIX_NATIVE_MACHINE机器处理器信息为IMAGE_FILE_MACHINE_I386或IMAGE_FILE_MACHINE_AMD64
IMAGE_FILE_MACHINE_AMD64 == 0x8664 == 34404 == AMD64 (K8)
# 5. Using the WiX extension’s results
<Launch Condition="WIX_NATIVE_MACHINE = 34404" Message="TODO Must run only on an x64 machine! TODO" />
# tools and concepts描述了构建的工具和处理
# MSbuild/Preprocessor/Specifying source files/Signing packages and bundles/Validation/Deployment Tools Foundation
# Windows Installer patches/Code pages/
# https://docs.firegiant.com/wix/tools/wixexe/#wix-msi-validate-subcommand
# https://docs.firegiant.com/wix/tools/msbuild/
# wix toolset微软教程:
# https://learn.microsoft.com/zh-cn/dotnet/core/extensions/windows-service-with-installer?tabs=wix
# wix toolset driver issues:
# https://docs.firegiant.com/wix/schema/difxapp
# https://github.com/wixtoolset/issues/issues/7625
# wixsharp:
# https://github.com/oleg-shilo/wixsharp/wiki/VS2019-%E2%80%93-2022-Templates
# DIFx安装已被弃用及替换方式: https://learn.microsoft.com/en-us/previous-versions/windows/drivers/install/difx-guidelines
# newdev.h设备和驱动程序安装: https://learn.microsoft.com/en-us/windows/win32/api/newdev/nf-newdev-diinstalldevice
# c#学习博客: https://blog.csdn.net/sinat_40003796/article/details/124885219
DiInstallDevice()
DiUninstallDevice()
DiInstallDriverW()
DiUninstallDriverW()
DiRollbackDriver()
DiShowUpdateDevice()
UpdateDriverForPlugAndPlayDevicesW()
1. Use SetupDiEnumDeviceInfo() and SetupDiGetDeviceRegistryProperty() to match your hardware ID.
2. To get the OEM INF path, SetupDiGetDriverInfoDetail() can be used instead of reading the registry directly.
3. Call DiUninstallDriver() on the resulting INF path (Microsoft recommends using it instead of SetupUninstallOEMInf().
In addition, it returns the needReboot flag, which may be useful in some scenarios.).
4. Call DiUninstallDevice() to uninstall device.
5. Call CM_Reenumerate_DevNode() to rescan all device.