我们正在使用Wix Toolset V3.11构建我们的设置。
由于以下声明,我们的默认安装路径为C:/Program Files(x86)/Acme/AppName
。
<Property Id="ApplicationFolderName" Value="$(var.Manufacturer)\$(var.AppFolderName)" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
通过设置中的“高级”按钮,我们将此路径更改为C:/Program Files(x86)/Acme/FooBar
:
以下声明将更改的路径保存在注册表中:
<RegistryKey
Key="Software\$(var.Manufacturer)\$(var.AppName)"
Root="HKLM">
<RegistryValue Id="InstallationRegistry"
Type="string"
Name="InstallDir"
Value="[APPLICATIONFOLDER]" />
</RegistryKey>
通过Regedit.exe,我可以按预期在注册表中看到路径C:/Program Files(x86)/Acme/FooBar
。很好
问题:但是,现在,当我运行更新的新设置时,所有文件都已从自定义文件夹C:/Program Files(x86)/Acme/FooBar
移至默认文件夹C:/Program Files(x86)/Acme/AppName
执行更新并单击“高级”按钮时,默认路径C:/Program Files(x86)/Acme/AppName
已预先分配:
我使用以下标记从注册表中查询路径:
<Property Id="APPLICATIONFOLDER">
<RegistrySearch Id='InstallationRegistrySearch' Type='raw' Root='HKLM' Key='Software\$(var.Manufacturer)\$(var.AppName)' Name='InstallDir' />
</Property>
以下是相关标记:
<Fragment>
<ComponentGroup Id="RootComponents" Directory="APPLICATIONFOLDER">
<Component Id="RootComponent" Guid="xxxxxxxxx" Win64='yes'>
<RegistryKey
Key="Software\$(var.Manufacturer)\$(var.AppName)"
Root="HKLM">
<RegistryValue Id="InstallationRegistry"
Type="string"
Name="InstallDir"
Value="[APPLICATIONFOLDER]" />
</RegistryKey>
</Component>
</ComponentGroup>
[...]
<Product ...>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="PROGRAMFILESPATH" Name="$(var.ProgramFilesPath)">
<Directory Id="ManufacturerFolder" Name="$(var.Manufacturer)">
<Directory Id="APPLICATIONFOLDER" Name="$(var.AppFolderName)" >
<!-- here are the application files (e.g. Appname.exe)-->
[...]
</Directory>
</Directory>
</Directory>
</Directory>
[...]
<Property Id="ApplicationFolderName" Value="$(var.Manufacturer)\$(var.AppFolderName)" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<Property Id="APPLICATIONFOLDER">
<RegistrySearch Id='InstallationRegistrySearch' Type='raw' Root='HKLM' Key='Software\$(var.Manufacturer)\$(var.AppName)' Name='InstallDir' />
</Property>
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<Property Id="ALLUSERS" Value="1"/>
[...]
<UI>
[...]
<UIRef Id="WixUI_Advanced"/>
</UI>
</Product>
我们在做什么错了?
答案 0 :(得分:1)
记住属性 :MSI不会自动保留属性值,因此需要诸如“ Remember Property Pattern”之类的模式。
位数 :您似乎正在从注册表中读回信息,但是可能是因为您遇到了“ 位数问题”?换句话说,您是从注册表的 x64部分中读取的,而不是从 x86部分中读取的? (反之亦然)。
HKEY_LOCAL_MACHINE\SOFTWARE\Manufacturer\Acme\Program
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Manufacturer\Acme\Program