我编写了一个与Windows XP完美配合的WiX安装程序,但是当安装到Windows 7机箱时,我遇到了注册表项的困难.我需要添加一个HKLM条目以及要在开始菜单中显示的程序的注册表项.这是我用于两种类型的条目的代码:
<!-- Create the registry entries for the program -->
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntriesInst" Guid="...">
<RegistryKey Root="HKLM"
Key="Software\$(var.Manufacturer)\$(var.ProductName)"
Action="createAndRemoveOnUninstall">
<RegistryValue
Type="string"
Name="installed"
Value="true"
KeyPath="yes"/>
</RegistryKey>
</Component>
<Component Id="RegistryEntriesVer" Guid="...">
<RegistryKey Root="HKLM"
Key="Software\$(var.Manufacturer)\$(var.ProductName)"
Action="createAndRemoveOnUninstall">
<RegistryValue
Type="string"
Name="version"
Value="$(var.ProductVersion)"
KeyPath="yes"/>
</RegistryKey>
</Component>
</DirectoryRef>
<!-- To add shortcuts to the start menu to run and uninstall the program -->
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="ApplicationShortcut" Guid="...">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="$(var.ProductName)"
Description="..."
Target="[SERVERLOCATION]$(var.Project.TargetFileName)"
WorkingDirectory="SERVERLOCATION"/>
<Shortcut Id="UninstallProduct"
Name="Uninstall $(var.ProductName)"
Description="..."
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"/>
<RemoveFolder Id="SERVERLOCATION" On="uninstall"/> …Run Code Online (Sandbox Code Playgroud) 这可能是一个天真的问题.我必须手动编辑.WXS文件,使其支持从命令行选择功能.
例如,.WXS文件中有3个功能.
<Feature Id="AllFeature" Level='1'>
<Feature Id="Feature1" Level='1'> </Feature>
<Feature Id="Feature2" Level='1'> </Feature>
<Feature Id="Feature3" Level='1'> </Feature>
</Feature>
Run Code Online (Sandbox Code Playgroud)
现在,我想从命令行中选择功能.比如,如果我键入"msiexec/i install.msi FEATURE = A",则安装"Feature1"和"Feature2"; 如果我输入"msiexec/i install.msi FEATURE = B",则安装"Feature1"和"Feature3".在这种情况下,"A"映射到要素1和2; "B"映射到要素1和3.
如何在WIX中完成此操作?
我想在构建32位和64位安装程序时保持我的顶级.wxs DRY.我正在使用candle.exe的-arch参数来控制构建的默认安装程序架构.
我现在正在讨论的是,看起来ProgramFilesFolder在32位和64位(ProgramFiles64Folder)架构之间是不同的.这是我第一次尝试解决的问题:
<?if $(sys.BUILDARCH)=x64 ?>
<Directory Id='ProgramFiles64Folder' Name='PFiles'>
<?else ?>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<?endif ?>
<Directory Id='the-rest' Name="Company Name">
...
Run Code Online (Sandbox Code Playgroud)
我尝试了这个错误.显然,在评估预处理器之前会触发XML验证.当我手动更改为使用ProgramFiles64Folder我的构建工作.
我试图沿着DirectoryRef路线走下去但没有成功.有关在没有在.wxs文件中进行sed替换的情况下使其工作的任何建议吗?
注意:我在Wix 3.5和3.6中试过这个.
我的要求是在programdata/test/example中创建一个目录.我怎么能在wix中这样做?
我的项目有一个简单的解决方案,效果很好.但我无法掌握如何使源路径相对.有人能帮助我吗?
<Component Id="Bla.exe" Guid="*">
<File Id="Bla.exe" Source="D:\Projects\Bla\Bla\bin\Debug\Bla.exe" KeyPath="yes" Checksum="yes"/>
</Component>
Run Code Online (Sandbox Code Playgroud)
如何使路径相对于Wix解决方案?WiX和所有必需的文件都在同一个解决方案中.
我需要将vdproj文件转换为WiX格式,以便我可以使用msbuild构建它.一个解决方案是从msbuild调用devenv可执行文件并从那里构建vdproj文件,但这只是讨厌.我以为我会尝试手动将文件转换为WiX格式,但查看其内容让我感到非常害怕.是否有任何工具或优雅的解决方案可能有助于此转换?
如何在WiX中创建静默安装程序,该安装程序不向用户显示任何UI对话框,并使用默认设置进行安装,升级和卸载?
我想在Windows注册表中保存我的应用程序的路径,与wix一起安装.我尝试了以下方法:
<RegistryValue Root="HKLM" Key="Software\company\InstallLocation" Value="[#INSTALLLOCATION]" Type="string" Action="write" />
Run Code Online (Sandbox Code Playgroud)
INSTALLLOCATIONWix中文件夹的目录ID 在哪里,但这不起作用.似乎[#id]语法仅适用于文件...
我看到了以下问题,但他所引用的博客似乎已不复存在:
如果尚未安装在客户端的计算机上,如何使用我的Wix软件包下载所需的.NET Framework?我已经有条件检查已安装的.NET版本,但我不知道如何在未找到时下载和安装它.
ClickOnce通过检查属性页面中的先决条件自动执行此操作.由于其他一些要求,我只需要在Wix中完成它.
谢谢!
我们需要将Windows服务的启动类型从"自动"修改为"自动延迟启动".我该怎么做呢?
我的代码是这样的:
<ServiceInstall
Id="WinServiceInstall"
Name="ServiceManager"
DisplayName="ServiceManager"
Type="ownProcess"
Start="auto"
ErrorControl="normal"
Vital ='yes'
Description ='Monitoring and running the jobs'
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]">
<util:ServiceConfig
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType ="restart"
cRestartServiceDelayInSeconds ="10" />
</ServiceInstall>
Run Code Online (Sandbox Code Playgroud)
如何设置重启服务时间?如果失败,我想在2分钟后设置重启服务.