嗨,我有以下 Heat.EXE 的示例组件输出。并且能够创建包含所有组件的 MSI 包。基本上我想在安装期间根据安装程序的参数(如 Dev 或 Prod 或 UAT 或 TEST)过滤以下文件。
即 msiexec -i prog.msi ENVPROPERTY="DEV" 或 msiexec -i prog.msi DEVPROPERTY=TRUE。
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Directory Id="dir58BD578D96681B39732F12EBF1B57BD3" Name="copyconfigfile" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="Copyconfig">
<Component Id="cmpBE90E7A6F30556F23DBCB608C0DB1CB3" Directory="dir572C565E70B3AEE6F0C29D3EE9056E9B" Guid="{912836FE-2289-405F-B65E-E0DF24E9F414}">
<File Id="fil9FB26501E72D582B49D01D1C17297C67" KeyPath="yes" Source="C:\Workspaces\Chatra\Website\CopyConfigFile\App_Config\ConnectionStrings.DevBuild.config.xml" />
</Component>
<Component Id="cmp6B5A7C518B7BE0889FC54F31700D9BFE" Directory="dir572C565E70B3AEE6F0C29D3EE9056E9B" Guid="{9733D8C9-60D3-4B24-B07A-53EB5B53D69B}">
<File Id="fil2936F4B979A59701F9D3FBAF1AED470D" KeyPath="yes" Source="C:\Workspaces\Chatra\Website\CopyConfigFile\App_Config\ConnectionStrings.ProductionBuild.config.xml" >
<CopyFile Id="Copy_Conn" DestinationProperty="DestFilesFolder" DestinationName="ConnectionStrings.config" />
</File>
</Component>
<Component Id="cmp0ECCAA5CAC3B3DD35D12C896CB3B2A5C" Directory="dir572C565E70B3AEE6F0C29D3EE9056E9B" Guid="{7A2D7A4A-FFA7-4AFC-8985-C35A19E54370}">
<File Id="fil4B00AD7679571D03A8678128738DE0A8" KeyPath="yes" Source="C:\Workspaces\Chatra\Website\CopyConfigFile\App_Config\ConnectionStrings.TestBuild.config.xml" />
</Component>
<Component Id="cmp044A32CEBC53EDFFB293831A711D14D8" Directory="dir572C565E70B3AEE6F0C29D3EE9056E9B" Guid="{B79DD704-FD08-4769-8A98-FF666DB84F12}">
<File Id="fil633E499D1A8430527DEE1A888B50CE9A" KeyPath="yes" Source="C:\Workspaces\Chatra\Website\CopyConfigFile\App_Config\ConnectionStrings.UATBuild.config.xml" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<DirectoryRef Id="dir58BD578D96681B39732F12EBF1B57BD3">
<Directory Id="dir572C565E70B3AEE6F0C29D3EE9056E9B" Name="App_Config" />
</DirectoryRef>
</Fragment>
</Wix>