我一直在寻找解决方案,但没有成功。我必须承认我是wix的始作俑者。我有一个针对x86和x64单独编译的项目(使用Visual Studio 2015的WPF + caliburn)。我使用x64机器创建两个MSI。不幸的是,在安装过程中,安装程序始终会写入64位寄存器,这会导致应用程序出现问题。
我创建了以下组件,试图使用Win64 =“ no”条目修复它,不幸的是没有成功。可以请建议正确的组件配置吗?
<DirectoryRef Id="TARGETDIR">
<?if $(var.Platform)="x64"?>
<Component Id="Registry_DefaultStoragePath" Guid="123-456-789" Win64="yes">
<RegistryKey Root="HKLM"
Key="Software\KeyName" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="DefaultStorageLocation" Value="[DEFAULTSTORAGE]" KeyPath="yes"/>
</RegistryKey>
</Component>
<Component Id="Registry_InstallType" Guid="123-456-789" Win64="yes">
<RegistryKey Root="HKLM"
Key="Software\KeyName" Action="createAndRemoveOnUninstall" >
<RegistryValue Type="string" Name="InstallType" Value="[INSTALLTYPE]" KeyPath="yes"/>
</RegistryKey>
</Component>
<?endif?>
<?if $(var.Platform)="x86"?>
<Component Id="Registry_DefaultStoragePath" Guid="132-456-789" Win64="no">
<RegistryKey Root="HKLM"
Key="Software\KeyName" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="DefaultStorageLocation" Value="[DEFAULTSTORAGE]" KeyPath="yes"/>
</RegistryKey>
</Component>
<Component Id="Registry_InstallType" Guid="123-456-789" Win64="no">
<RegistryKey Root="HKLM"
Key="Software\KeyName" Action="createAndRemoveOnUninstall" >
<RegistryValue Type="string" Name="InstallType" Value="[INSTALLTYPE]" KeyPath="yes"/>
</RegistryKey>
</Component>
<?endif?>
主要问题是<?if $(var.Platform)="x64"?>
由预处理器处理的,因此它是在编译时而不是运行时进行评估的。
为了处理x86 / x64运行时,您可以执行以下操作:
<component ....>
<condition>NOT VersionNT64</condition>
<!-- 32 bit component -->
<!-- Add component content here -->
</component>
<component ....>
<condition>VersionNT64</condition>
<!-- 64 bit component -->
<!-- Add component content here -->
</component>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句