【发布时间】:2018-02-21 14:09:28
【问题描述】:
在发布的 MSI 中,我有硬编码的端口号,例如
<Property Id="HTTP_PORT1" Secure="yes" Value="1000" />
<Component Id="my.exe" Guid="*" Win64="yes" >
<File Id="my.exe" KeyPath="yes" Source="my.exe" />
<RegistryValue Root="HKLM" Key="SOFTWARE\MyCompany" Name="Port1" Value="[HTTP_PORT1]" Type="integer" />
<RegistryValue Root="HKLM" Key="SOFTWARE\MyCompany" Name="Port2" Value="9000" Type="integer" />
</Component>
对于补丁,我的 Patch.wxs 看起来像这样:
<PatchFamily Id="Rollup" Version="1.0.100" Supersede="yes">
<ComponentRef Id="my.exe"/>
</PatchFamily>
当我手动将这些 reg 更改为“1111”和“9999”并应用补丁 MSP 时,那些 Port1 和 Port2 分别设置回“1000”和“9000”。所以我改变了“HTTP_PORT1”并像这样添加了“INT_HTTP_PORT2”:
<Property Id="HTTP_PORT1" Secure="yes" Value="#1000" >
<RegistrySearch Root="HKLM" Key="SOFTWARE\MyCompany" Name="Port1" Type="raw" Win64="yes" />
</Property>
<Property Id="INT_HTTP_PORT2" Secure="yes" Value="#9000" >
<RegistrySearch Root="HKLM" Key="SOFTWARE\MyCompany" Name="Port2" Type="raw" Win64="yes" />
</Property>
<Component Id="my.exe" Guid="*" Win64="yes" >
<File Id="my.exe" KeyPath="yes" Source="my.exe" />
<RegistryValue Root="HKLM" Key="SOFTWARE\MyCompany" Name="Port1" Value="[HTTP_PORT1]" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\MyCompany" Name="Port2" Value="[INT_HTTP_PORT2]" Type="string" />
</Component>
然后我像这样更改了 Patch.wxs:
<PatchFamily Id="Rollup" Version="1.0.100" Supersede="yes">
<ComponentRef Id="my.exe"/>
<PropertyRef Id="HTTP_PORT1"/>
<PropertyRef Id="INT_HTTP_PORT2"/>
</PatchFamily>
但是,Port1 和 Port2 都改回了原始值(尽管 Port1 现在是 REG_SZ。) 这是预期的行为吗?是否可以在不使用 Type1 自定义操作的情况下使其在补丁中工作?
【问题讨论】:
标签: properties wix windows-installer patch