1.<Property Id="MsiLogging" Value="voicewarmupx!"/> 输出日志。
MsiLogging This property is available starting with Windows Installer 4.0.
2.激活msi安装日志(xp)
运行gpedit.msc->计算机配置->管理模板->windows组件->windows installer->日志记录->已启用,日志记录参数:voicewarmupx
参考https://support.microsoft.com/zh-cn/help/223300/how-to-enable-windows-installer-logging
3.一个wxs文件支持两个编译平台
在wxs工程中定义如下:
<?if $(var.Platform) = x64 ?>
<?define ProductName = "你的工程 Project (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define System32Dir = "System64Folder" ?>
<?define System32DriverDir = "System64DriversDir" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<!--?define FilePath = $(var.SolutionDir)$(var.Platform)\ ?-->
<?define FilePath = "Win64" ?>
<?else ?>
<?define ProductName = "你的工程 Setup Project (32 bit)" ?>
<?define Win64 = "no" ?>
<?define System32Dir = "SystemFolder" ?>
<?define System32DriverDir = "SystemDriversDir" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?define FilePath = "Win32" ?>
<?endif ?>
然后在需要用到的地方插入该变量。
如<Product Id="[your unique GUID]" Name="$(var.ProductName)" Language="2052" Codepage="936" Version="1.0.0.0" Manufacturer="xxx" UpgradeCode="xxxxxxxxx">
4.wix内实现安装windows服务。
<Component Id="ServiceInstall" Guid="your Guid" Directory="WindowsFolder">
<File Id="ServiceInstaller" Name="yourService.exe" DiskId="1" KeyPath="yes" Source="..\..\..\output\$(var.FilePath)\yourService.exe" />
<ServiceInstall Id="yourServerInstall"
Name="yourService"
DisplayName="yourService"
Type="ownProcess"
Start="auto"
Vital="yes"
Interactive="no"
ErrorControl="normal"
Description="yourService 服务"
Account="LocalSystem">
<util:PermissionEx
User="LocalSystem"
GenericAll="yes"
ServiceChangeConfig="yes"
ServiceEnumerateDependents="yes"
ChangePermission="yes"
ServiceInterrogate="yes"
ServicePauseContinue="no"
ServiceQueryConfig="yes"
ServiceQueryStatus="yes"
ServiceStart="yes"
ServiceStop="yes"
ServiceUserDefinedControl="yes" />
<util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="none" />
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="yourService" Wait="no" />
</Component>
首先,必须要保证yourService.exe是一个可以作为服务启动的应用程序。其次,标签ServiceInstall 内的Name和ServiceControl的Name要保证是相同的值。另外,此处可以配置服务是否可以与桌面交互,通过Interactive的值来控制。
4.package code ----每次对msi对应的wix工程rebuild 都会重新生成一个新的package code