简体   繁体   中英

Keep Property names during HEAT harvesting of registry files for WIX installer

I have a list of registry files in a folder that should be harvested by HEAT. Some of these registry entries need to use Wix Property Values in the harvested WXS file, eg to dynamically set directories etc. When I now specify the Property with square brackets already in the REG file the square brackets get escaped during harvesting and the values are not interpreted anymore as WIX properties.

How can I avoid the escaping?

example reg file:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\someMorePaths]
@="[MyDirectoryPropertyName]\\filename.ext"

heat harvesting command:

"C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe" reg .\myregfile.reg -o .\reg_generated.wxs ^
-v -cg MyComponentGroup

the problematic escaped output

<Component Id="myId" Directory="TARGETDIR" Guid="*">
  <RegistryKey Key="Software\someMorePaths" Root="HKCU">
    <RegistryValue Value="[\[]MyDirectoryPropertyName[\]]\filename.ext" Type="string" />
  </RegistryKey>
</Component>

This causes the WIX installer to not interpret MyDirectoryPropertyName anymore

I used a PowerShell command to remove the incorrectly escaped characters and included it in the Build scripts:

powershell -Command "(Get-Content .\reg_generated.wxs) -replace '\\\[\]', '' | Out-File -encoding ASCII .\reg_generated.wxs"
powershell -Command "(Get-Content .\reg_generated.wxs) -replace '\[\\\]', '' | Out-File -encoding ASCII .\reg_generated.wxs"

an option to change the behaviour directly in heat.exe I have not found

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM