WixToolset目录结构复制

我有一个任务来创buildnodejs web应用程序的安装。 我已经find解决scheme来压缩整个应用程序将其作为一个Wix文件复制,并使用wix自定义操作将其解压缩。 这工作。 但其缺点是,targt服务器必须安装压缩软件。 在这种情况下7z。

看着其他安装,他们正在提取任何外部软件的文件。

我已经调查了一下,有一点说,我应该使用热,坚果我不知道这是什么。 有任何简单的启动例子,我可以从概念上理解它。 我也发现其他人在Wix上的学习曲线很慢。 我非常认真地学习这个,但是我需要一点点的努力。 我想从这个例子开始。

如何整个文件夹复制wix? 或者最好的实践。 也许有些压缩与第三方软件。

编辑:

这是我的wixproj文件的样子:

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">x86</Platform> <ProductVersion>3.10</ProductVersion> <ProjectGuid>a42f686d-72e6-4452-b066-796c441e0d65</ProjectGuid> <SchemaVersion>2.0</SchemaVersion> <OutputName>SomeManager</OutputName> <OutputType>Package</OutputType> <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <OutputPath>bin\$(Configuration)\</OutputPath> <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> <DefineConstants>Debug</DefineConstants> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <OutputPath>bin\$(Configuration)\</OutputPath> <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> </PropertyGroup> <ItemGroup> <Compile Include="Product.wxs" /> </ItemGroup> <ItemGroup> <Content Include="google-credentials-release-server.p12" /> <Content Include="LICENSE.rtf" /> <Content Include="some_service.tar.gz"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="XSLT\readme.txt" /> <Content Include="XSLT\RegisterForCOM.xml" /> <Content Include="XSLT\XslFile.xslt" /> <Content Include="XSLT\XslProjectOutput.xslt" /> <Content Include="XSLT\XslRegisterForCOM.xslt" /> <Content Include="XSLT\_ERMPanel.xml" /> </ItemGroup> <ItemGroup> <WixExtension Include="WixUtilExtension"> <HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath> <Name>WixUtilExtension</Name> </WixExtension> <WixExtension Include="WixUIExtension"> <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath> <Name>WixUIExtension</Name> </WixExtension> </ItemGroup> <ItemGroup> <Folder Include="XSLT\" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\ERMPanel\ERMPanel.csproj"> <Name>ERMPanel</Name> <Project>{F62EB2B5-967E-4E32-BE06-89248AFA3385}</Project> <Private>True</Private> <DoNotHarvest> </DoNotHarvest> <RefProjectOutputGroups>Binaries</RefProjectOutputGroups> <RefTargetDir>INSTALLDIR</RefTargetDir> </ProjectReference> </ItemGroup> <Import Project="$(WixTargetsPath)" /> <Target Name="BeforeBuild"> <MakeDir Directories="$(IntermediateOutputPath)Harvested XML" /> <MakeDir Directories="$(IntermediateOutputPath)Harvested Output" /> <XslTransformation XmlInputPaths="XSLT\RegisterForCOM.xml" XslInputPath="XSLT\XslRegisterForCOM.xslt" OutputPaths="$(IntermediateOutputPath)_COMFiles.txt" Parameters="&lt;Parameter Name='operationType' Value='HeatFiles'/&gt;&lt;Parameter Name='intermediateDir' Value='$(IntermediateOutputPath)'/&gt;" Condition="$(MSBuildToolsVersion) &lt;= 12" /> <XslTransformation XmlInputPaths="XSLT\RegisterForCOM.xml" XslInputPath="XSLT\XslRegisterForCOM.xslt" UseTrustedSettings="true" OutputPaths="$(IntermediateOutputPath)_COMFiles.txt" Parameters="&lt;Parameter Name='operationType' Value='HeatFiles'/&gt;&lt;Parameter Name='intermediateDir' Value='$(IntermediateOutputPath)'/&gt;" Condition="$(MSBuildToolsVersion) &gt;= 14" /> <ReadLinesFromFile File="$(IntermediateOutputPath)_COMFiles.txt"> <Output TaskParameter="Lines" ItemName="COMFilelist" /> </ReadLinesFromFile> <ConvertToAbsolutePath Paths="@(COMFilelist)"> <Output TaskParameter="AbsolutePaths" ItemName="ResolvedCOMFilelist" /> </ConvertToAbsolutePath> <Exec Command="&quot;$(Wix)Bin\heat.exe&quot; file &quot;%(ResolvedCOMFilelist.Identity)&quot; -sw -gg -sfrag -nologo -srd -out &quot;$(IntermediateOutputPath)Harvested XML\_%(Filename).com.xml&quot;" IgnoreExitCode="false" WorkingDirectory="$(MSBuildProjectDirectory)" Condition="'%(ResolvedCOMFilelist.Identity)'!=''" /> <XslTransformation XmlInputPaths="XSLT\RegisterForCOM.xml" XslInputPath="XSLT\XslRegisterForCOM.xslt" OutputPaths="$(IntermediateOutputPath)_COMFiles.txt" Parameters="&lt;Parameter Name='operationType' Value='TransformFiles'/&gt;&lt;Parameter Name='intermediateDir' Value='$(IntermediateOutputPath)Harvested XML\'/&gt;" Condition="$(MSBuildToolsVersion) &lt;= 12" /> <XslTransformation XmlInputPaths="XSLT\RegisterForCOM.xml" XslInputPath="XSLT\XslRegisterForCOM.xslt" UseTrustedSettings="true" OutputPaths="$(IntermediateOutputPath)_COMFiles.txt" Parameters="&lt;Parameter Name='operationType' Value='TransformFiles'/&gt;&lt;Parameter Name='intermediateDir' Value='$(IntermediateOutputPath)Harvested XML\'/&gt;" Condition="$(MSBuildToolsVersion) &gt;= 14" /> <ReadLinesFromFile File="$(IntermediateOutputPath)_COMFiles.txt"> <Output TaskParameter="Lines" ItemName="XMLFileList" /> </ReadLinesFromFile> <XslTransformation XmlInputPaths="%(XMLFileList.Identity)" XslInputPath="XSLT\XslFile.xslt" OutputPaths="$(IntermediateOutputPath)Harvested Output\%(Filename).wsx" Parameters="&lt;Parameter Name='sourceFilePath' Value='%(XMLFileList.Identity)'/&gt;" Condition="'%(XMLFileList.Identity)'!='' And $(MSBuildToolsVersion) &lt;= 12" /> <XslTransformation XmlInputPaths="%(XMLFileList.Identity)" XslInputPath="XSLT\XslFile.xslt" UseTrustedSettings="true" OutputPaths="$(IntermediateOutputPath)Harvested Output\%(Filename).wsx" Parameters="&lt;Parameter Name='sourceFilePath' Value='%(XMLFileList.Identity)'/&gt;" Condition="'%(XMLFileList.Identity)'!='' And $(MSBuildToolsVersion) &gt;= 14" /> <Exec Command="&quot;$(Wix)Bin\heat.exe&quot; project &quot;%(ProjectReference.FullPath)&quot; -projectname &quot;%(ProjectReference.Name)&quot; -pog %(ProjectReference.RefProjectOutputGroups) -gg -sfrag -nologo -out &quot;$(IntermediateOutputPath)Harvested XML\_%(ProjectReference.Name).xml&quot;" IgnoreExitCode="false" WorkingDirectory="$(MSBuildProjectDirectory)" Condition="'%(ProjectReference.FullPath)'!='' And '%(ProjectReference.DoNotHarvest)'!='True' And '%(ProjectReference.ImportedFromVDProj)'=='True'" /> <HeatProject Project="%(ProjectReference.FullPath)" ProjectName="%(ProjectReference.Name)" OutputFile="$(IntermediateOutputPath)Harvested XML\_%(ProjectReference.Name).xml" ProjectOutputGroups="%(ProjectReference.RefProjectOutputGroups)" ToolPath="$(Wix)Bin\" SuppressAllWarnings="true" AutogenerateGuids="false" GenerateGuidsNow="true" SuppressFragments="true" SuppressUniqueIds="false" Condition="'%(ProjectReference.FullPath)'!='' And '%(ProjectReference.DoNotHarvest)'!='True' And '%(ProjectReference.ImportedFromVDProj)'!='True'" /> <XslTransformation XmlInputPaths="$(IntermediateOutputPath)Harvested XML\_%(ProjectReference.Name).xml" XslInputPath="XSLT\XslProjectOutput.xslt" OutputPaths="$(IntermediateOutputPath)Harvested Output\_%(ProjectReference.Name).wxs" Parameters="&lt;Parameter Name='projectName' Value='%(ProjectReference.Name)'/&gt;&lt;Parameter Name='projectFilePath' Value='%(ProjectReference.FullPath)'/&gt;&lt;Parameter Name='intermediateDir' Value='$(IntermediateOutputPath)Harvested Output\'/&gt;" Condition="'%(ProjectReference.FullPath)'!='' And '%(ProjectReference.DoNotHarvest)'!='True' And Exists('$(IntermediateOutputPath)Harvested XML\_%(ProjectReference.Name).xml') And $(MSBuildToolsVersion) &lt;= 12" /> <XslTransformation XmlInputPaths="$(IntermediateOutputPath)Harvested XML\_%(ProjectReference.Name).xml" XslInputPath="XSLT\XslProjectOutput.xslt" UseTrustedSettings="true" OutputPaths="$(IntermediateOutputPath)Harvested Output\_%(ProjectReference.Name).wxs" Parameters="&lt;Parameter Name='projectName' Value='%(ProjectReference.Name)'/&gt;&lt;Parameter Name='projectFilePath' Value='%(ProjectReference.FullPath)'/&gt;&lt;Parameter Name='intermediateDir' Value='$(IntermediateOutputPath)Harvested Output\'/&gt;" Condition="'%(ProjectReference.FullPath)'!='' And '%(ProjectReference.DoNotHarvest)'!='True' And Exists('$(IntermediateOutputPath)Harvested XML\_%(ProjectReference.Name).xml') And $(MSBuildToolsVersion) &gt;= 14" /> <XslTransformation XmlInputPaths="XSLT\RegisterForCOM.xml" XslInputPath="XSLT\XslRegisterForCOM.xslt" OutputPaths="$(IntermediateOutputPath)_COMFiles.txt" Parameters="&lt;Parameter Name='operationType' Value='CompileFiles'/&gt;&lt;Parameter Name='intermediateDir' Value='$(IntermediateOutputPath)Harvested Output\'/&gt;" Condition="$(MSBuildToolsVersion) &lt;= 12" /> <XslTransformation XmlInputPaths="XSLT\RegisterForCOM.xml" XslInputPath="XSLT\XslRegisterForCOM.xslt" UseTrustedSettings="true" OutputPaths="$(IntermediateOutputPath)_COMFiles.txt" Parameters="&lt;Parameter Name='operationType' Value='CompileFiles'/&gt;&lt;Parameter Name='intermediateDir' Value='$(IntermediateOutputPath)Harvested Output\'/&gt;" Condition="$(MSBuildToolsVersion) &gt;= 14" /> <ReadLinesFromFile File="$(IntermediateOutputPath)_COMFiles.txt"> <Output TaskParameter="Lines" ItemName="WSXFileList" /> </ReadLinesFromFile> <CreateItem Include="$(IntermediateOutputPath)Harvested Output\_%(ProjectReference.Name).wxs" Condition="'%(ProjectReference.FullPath)'!='' And '%(ProjectReference.DoNotHarvest)'!='True' And Exists('$(IntermediateOutputPath)Harvested Output\_%(ProjectReference.Name).wxs')"> <Output TaskParameter="Include" ItemName="Compile" /> </CreateItem> <CreateItem Include="@(WSXFileList)" Condition="Exists('%(WSXFileList.Identity)')"> <Output TaskParameter="Include" ItemName="Compile" /> </CreateItem> </Target> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Wix.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project> 

这里是Product.wsx文件:

 <?xml version="1.0" encoding="utf-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="*" Name="SomeManager" Language="1033" Version="1.0.0.2" Manufacturer="Certus" UpgradeCode="4810b5e4-21d8-4a45-b289-eafb10dddc0a"> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> <Media Id="1" Cabinet="Cab1.cab" EmbedCab="yes" /> <Feature Id="ProductFeature" Title="SomeInstaller" Level="1"> <ComponentGroupRef Id="ProductComponents" /> <ComponentGroupRef Id="ERMPanel.Binaries" /> <ComponentRef Id="comp_5D704CE7_9E55_4FC5_8CB2_6BA4612D6D35" /> <ComponentRef Id="comp_C9901889_BAD5_4B2C_9407_EAF967B1526C" /> <ComponentRef Id="comp_03332461_4D6C_4BB5_90D1_4C4D896D7775" /> <ComponentRef Id="comp_3AE770A3_904C_4458_81BD_300F195A4250" /> <ComponentRef Id="comp_dir_8F9BAB58_4415_4353_BE9E_36C8F7EEF78A" /> </Feature> <UIRef Id="WixUI_InstallDir" /> <WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" /> <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" /> <CustomAction Id="ExtractService" Directory="INSTALLFOLDER" Impersonate="no" Execute="deferred" ExeCommand="7z e -y some_service.tar.gz" Return="check" /> <CustomAction Id="ExtractService2" Directory="INSTALLFOLDER" Impersonate="no" Execute="deferred" ExeCommand="7z x -y some_service.tar" Return="check" /> <!--<CustomAction Id="Create_Some_Files" Directory="INSTALLFOLDER" ExeCommand="cmd /C &quot;mkdir some_files&quot;" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" /> <CustomAction Id="Copy_p12" Directory="INSTALLFOLDER" ExeCommand="cmd /C &quot;xcopy google-credentials-release-server.p12 some_files&quot;" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />--> <!--<CustomAction Id="Create_Log" Directory="INSTALLFOLDER" ExeCommand="cmd /C &quot;mkdir Logs&quot;" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />--> <CustomAction Id="Cleanup_tarfile" Directory="INSTALLFOLDER" ExeCommand="cmd /C &quot;del some_service.tar&quot;" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" /> <CustomAction Id="Cleanup_targzfile" Directory="INSTALLFOLDER" ExeCommand="cmd /C &quot;del some_service.tar.gz&quot;" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" /> <CustomAction Id="Cleanup_bundle" Directory="INSTALLFOLDER" ExeCommand="cmd /C RD &quot;[INSTALLFOLDER]&quot; /s /q" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" /> <!--<CustomAction Id="Cleanup_Some_Files" Directory="INSTALLFOLDER" ExeCommand="cmd /C RD &quot;some_files&quot; /s /q" Execute="deferred" Return="ignore" HideTarget="no" Impersonate="no" />--> <InstallExecuteSequence> <Custom Action="ExtractService" Before="InstallFinalize">NOT Installed</Custom> <Custom Action="ExtractService2" After="ExtractService">NOT Installed</Custom> <!--<Custom Action="Create_Some_Files" After="ExtractService">NOT Installed</Custom> <Custom Action="Copy_p12" After="Create_Some_Files">NOT Installed</Custom>--> <!--<Custom Action="Create_Log" After="ExtractService2">NOT Installed</Custom>--> <Custom Action="Cleanup_tarfile" Before="RemoveFiles">REMOVE="ALL"</Custom> <Custom Action="Cleanup_targzfile" Before="RemoveFiles">REMOVE="ALL"</Custom> <Custom Action="Cleanup_bundle" Before="RemoveFiles">REMOVE="ALL"</Custom> <!--<Custom Action="Cleanup_Some_Files" Before="RemoveFiles">REMOVE="ALL"</Custom>--> </InstallExecuteSequence> <UI /> </Product> <Fragment> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLFOLDER" Name="SomeInstaller"> <Directory Id="ERMPanel.Binaries" /> <Directory Id="dir_585C16B3_5205_4D63_87F5_D7576697D2A9" Name="some_files"> <Component Id="comp_3AE770A3_904C_4458_81BD_300F195A4250" Guid="E117F3ED-771F-4547-9713-4A8FCDF173C8" Permanent="no" SharedDllRefCount="no" Transitive="no"> <File Id="_95238475_7B18_4058_82A2_B56483BCEFD1" DiskId="1" Hidden="no" ReadOnly="no" TrueType="no" System="no" Vital="yes" Name="google-credentials-release-server.p12" Source="google-credentials-release-server.p12" KeyPath="yes" /> </Component> </Directory> <Directory Id="dir_8F9BAB58_4415_4353_BE9E_36C8F7EEF78A" Name="Logs"> <Component Id="comp_dir_8F9BAB58_4415_4353_BE9E_36C8F7EEF78A" Guid="2EB4F74F-2FF4-42A6-B149-746C25950972" KeyPath="yes"> <CreateFolder Directory="dir_8F9BAB58_4415_4353_BE9E_36C8F7EEF78A" /> <RemoveFolder Id="id_026B5F17_73B3_4F92_803A_7ED05A3E3D7A" On="uninstall" Directory="dir_8F9BAB58_4415_4353_BE9E_36C8F7EEF78A" /> </Component> </Directory> </Directory> </Directory> <Directory Id="DesktopFolder"> <Component Id="comp_5D704CE7_9E55_4FC5_8CB2_6BA4612D6D35" Guid="32628FC1-02E6-486C-88BD-1E1B3EB24E44" Permanent="no" SharedDllRefCount="no" Transitive="no"> <Shortcut Id="_337FA89F_92ED_457C_899C_5344A548FD97" Directory="DesktopFolder" Name="ERMPanel" Show="normal" Target="[INSTALLFOLDER]ERMPanel.exe" WorkingDirectory="INSTALLFOLDER" /> <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\Installer" Name="comp_5D704CE7_9E55_4FC5_8CB2_6BA4612D6D35" Type="string" Value="User's Desktop directory" KeyPath="yes" /> </Component> </Directory> <Directory Id="StartMenuFolder"> <Component Id="comp_03332461_4D6C_4BB5_90D1_4C4D896D7775" Guid="98E2BC79-8D59-4FEF-B235-92BB611CC608" Permanent="no" SharedDllRefCount="no" Transitive="no"> <Shortcut Id="_69EBF121_EA14_40B0_A587_1F520C033E45" Directory="StartMenuFolder" Name="ERMPanel" Show="normal" Target="[INSTALLFOLDER]ERMPanel.exe" WorkingDirectory="INSTALLFOLDER" /> <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\Installer" Name="comp_03332461_4D6C_4BB5_90D1_4C4D896D7775" Type="string" Value="User's Start Menu directory" KeyPath="yes" /> </Component> </Directory> <Directory Id="ProgramMenuFolder"> <Component Id="comp_C9901889_BAD5_4B2C_9407_EAF967B1526C" Guid="AAA016CC-1B36-417A-A5EA-CB92A1A440AF" Permanent="no" SharedDllRefCount="no" Transitive="no"> <Shortcut Id="_3732D7A6_3230_4CCB_8037_3DA1D02E98E6" Directory="ProgramMenuFolder" Name="ERMPanel" Show="normal" Target="[INSTALLFOLDER]ERMPanel.exe" WorkingDirectory="INSTALLFOLDER" /> <RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]\Installer" Name="comp_C9901889_BAD5_4B2C_9407_EAF967B1526C" Type="string" Value="User's Programs Menu directory" KeyPath="yes" /> </Component> </Directory> </Directory> </Fragment> <Fragment> <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> <Component Id="packages" Guid=""> <File Source="some_service.tar.gz" /> </Component> </ComponentGroup> </Fragment> </Wix> 

我正在做的是手动压缩节点应用程序到文件some_service.tar.gz,然后我复制它作为一个单一的文件,并提取它在自定义操作。 当然这是错误的。 我想只有nodejsdir在与some_service.tar.gz相同的地方,并复制与heat.exe

我必须承认,如果你能帮助我,请根据我的例子,我觉得这很混乱。

谢谢。

热是wix中包含的收获工具。 如果在生成计算机上具有要在安装计算机上复制的目录结构,则可以使用它来自动收集数百个文件。

如果你所包含的文件变化频繁,build立一个热任务来运行每一个构build是你应该做的事情。 如果包含的文件相当静态,而且您只需要添加/删除或移动一些文件,请使用加热生成所有文件的第一个WXS,然后在需要时手动更新。

不要忘记,msi已经压缩了它所包含的所有文件,没有理由将所有文件压缩成一个zip文件,然后将其包含到您的msi文件中,只有在“安装”之后才能将其解压缩。 您最终会在客户的机器上占用过多的空间,并且可能无法安装,因为MSI无法正确执行文件成本计算,并且在解包时可能会耗尽磁盘空间。

当您使用包含所有文件的zip文件时,您还会放弃windows安装程序的所有有用的文件跟踪和处理function。 卸载需要额外的步骤,升级基本上不可能做得很好。 在失败期间不能回滚。

我用我的wixproj的“BeforeBuild”任务来获取产品的“帮助”目录。

我有一个名为genComponents.targets的文件,其中包含

 <?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildThisFileDirectory)..\CommonBuild.props" Condition="$(_CommonBuildPropertyLoaded) != 'true'"/> <PropertyGroup> <HeatEXE>$(WixToolPath)Heat.exe</HeatEXE> </PropertyGroup> <Target Name="GenHelpDependsOn"> <PropertyGroup> <HelpHeatArgs>dir &quot;$(MSBuildThisFileDirectory)..\..\Help&quot; -gg -cg BinHelp -dr BINHELP -template fragment -sreg -sfrag -srd -var var.dirHELP -o &quot;$(MSBuildThisFileDirectory)Components\BinHelp.wxs&quot;</HelpHeatArgs> </PropertyGroup> </Target> <Target Name="GenBinHelp" DependsOnTargets="GenHelpDependsOn"> <Exec Command="&quot;$(HeatEXE)&quot; $(HelpHeatArgs)" Condition="!Exists('$(MSBuildThisFileDirectory)Components\BinHelp.wxs')"/> </Target> </Project> 

只是使用

  <Target Name="BeforeBuild" DependsOnTargets="GenBinHelp" /> 

在我的wixproj将为所有帮助文件的目录生成BinHelp组件组的wxs。 我们支持的所有语言都有一千个左右的帮助文件。

在wixproj中,我将wxs添加为一个链接,并确保它作为ComponentGroupRef包含在一个特性中。

你可以在你的beforebuild任务中包含一个<Exec>任务,所有正确的参数我只是使用第二个文件,因为我有很多热量任务。 有很多不同的论点来加热,你可以看看他们加热/? 去看他们。

只需在你的js目录上运行heat.exe,看看它的样子。


在一个项目中,我收获的所有文件有3836个文件。 这是构build过程。 我从networking位置抓取构build的二进制文件和其他文件的zip文件,并将所有文件内容解压到一个名为ZipFolder的文件夹中。

在我的wixproj中,我在构build目标之前join了一个热量调用

 <Target Name="BeforeBuild" > <Exec Command="&quot;$(WixToolPath)Heat.exe&quot; dir &quot;$(MSBuildThisFileDirectory)..\Binaries\ZipFolder&quot; -ag -cg SDK -dr INSTALLDIR -suid -sreg -sfrag -srd -var var.ZipFolderDir -o &quot;$(MSBuildThisFileDirectory)..\src\InstallerSDK\Components\SDKFiles.wxs&quot;" Condition="!Exists('$(MSBuildThisFileDirectory)..\src\InstallerSDK\Components\SDKFiles.wxs')" /> </Target> 

并在我的wixproj我添加一个现有的文件SDKFiles.wxs作为一个链接(添加button上的小箭头显示下拉与“作为链接”)

我正在使用几个cmd行开关,在您使用的热调用中没有定义这些开关,以便我可以正确引用生成的文件组件。 首先我使用-var var.ZipFolderDir,这使得你的文件的源代码等于$(var.ZipFolderDir)\ rest \ of \ path.dll。 你可以在你的defineconstants中定义这个variables(每个configuration一个):

  <DefineConstants>Debug;ZipFolderDir=$(MSBuildThisFileDirectory)..\Binaries\ZipFolder\;</DefineConstants> <DefineConstants>ZipFolderDir=$(MSBuildThisFileDirectory)..\Binaries\ZipFolder\;</DefineConstants> 

另一个区别是使用-dr INSTALLFOLDER ,它将顶级目录设置为INSTALLFOLDER,INSTALLFOLDER由product.wxs中的INSTALLFOLDER目录定义。

最后还有-cg SDK定义了组件组的名称,该组件包含了所有通过加热收集的文件。 这里是我们与ComponentGroupRef配合使用的主要product.wxs

 <Feature Id="ProductFeature" Title="SomeInstaller" Level="1"> <ComponentGroupRef Id="SDK" /> <ComponentGroupRef Id="ERMPanel.Binaries" /> <ComponentRef Id="comp_5D704CE7_9E55_4FC5_8CB2_6BA4612D6D35" /> <ComponentRef Id="comp_C9901889_BAD5_4B2C_9407_EAF967B1526C" /> <ComponentRef Id="comp_03332461_4D6C_4BB5_90D1_4C4D896D7775" /> <ComponentRef Id="comp_3AE770A3_904C_4458_81BD_300F195A4250" /> <ComponentRef Id="comp_dir_8F9BAB58_4415_4353_BE9E_36C8F7EEF78A" /> </Feature> 

您可以移除product.wxs底部的ProductComponents组

我从来没有使用<HarvestProject>但我知道wix已经定义了丰收目标,但我从来没有花时间来弄清楚如何使用它们。 我也从来没有用过一个项目的热量,所以我不能真的帮助那里。 由于我们使用的构build过程,所有我的安装程序项目都是作为自己的独立项目构build的。 通常他们抓住一个二进制文件的zip并解压缩到一个二进制文件夹,然后build立安装程序调用一些文件夹的热量。