我在wix安装程序中使用热能。一开始,我在没有任何属性的情况下尝试它,它就像一个护身符一样工作。我将heat命令添加到预构建事件中,并将sourceDir声明添加到链接器中。现在,我想将属性传递给wix,以获取不同的文件夹。属性可以很好地传递给wxs文件,例如Version="$(var.PRODUCTVERSION)",但不能在预构建事件或链接器参数中使用,例如"%wix%\bin\heat.exe" dir "$(var.FOLDER)\work\" -cg Files -dr INSTALLFOLDER -gg -scom -sreg -sfrag -srd -out "FilesHeat.wxs"。
有什么想法吗?
发布于 2015-11-19 15:02:25
你可以卸载你的wix项目,最后添加下面的代码
<Import Project="$(WixTargetsPath)" />
<Target Name="BeforeBuild">
<HeatDirectory NoLogo="True" ToolPath="$(Wix)\bin" GenerateGuidsNow="True" OutputFile="$(MSBuildProjectDirectory)\Cmp_Gp_SQLFiles.wxs" Directory="..\_Dependencies\SQL" ComponentGroupName="Cmp_Gp_SQLFiles" DirectoryRefId="DIR_Sql" PreprocessorVariable="var.SQLFolder" SuppressFragments="True" SuppressUniqueIds="True" SuppressCom="True" SuppressRootDirectory="True" SuppressRegistry="True" RunAsSeparateProcess="True" />
</Target>Save file.And构建项目。
它将生成如下所示Cmp_Gp_SQLFiles.wxs文件:
<Fragment>
<DirectoryRef Id="DIR_Sql">
<Component Id="sample.sql" Guid="PUT_GUID_HERE">
<File Id="sample.sql" KeyPath="yes" Source="$(var.SQLFolder)\sample.sql" />
</Component>
...
</DirectoryRef>
<Fragment>
<ComponentGroup Id="Cmp_Gp_SQLFiles">
<ComponentRef Id="sample.sql" />
...
</ComponentGroup>
</Fragment>如果您不希望文件id与文件名相同,请将SuppressUniqueIds=false。
根据您的需求进行更改。
https://stackoverflow.com/questions/33785104
复制相似问题