2016-05-16 3 views
2

У меня есть задача создать установку для веб-приложения nodejs. Я нашел решение для сжатия всего приложения скопировать его как один файл с помощью Wix и извлечь его с помощью специальных действий wix. Это работает. Но его недостатком является то, что сервер Targt должен иметь сжатие программного обеспечения. В этом случае 7z.Структура структуры каталога WixToolset

Наблюдая за другими установками, они извлекают файлы с помощью любого внешнего программного обеспечения.

Я изучаю wix немного, он говорит, что я должен использовать ТЕПЛО, орех, я не уверен, что это. Там есть простые примеры запуска, где я могу понять это концептуально. Я узнал также, что у других парней есть медленная кривая обучения на Wix. Я очень серьезно изучаю это, но мне нужно немного толкнуть. Я хотел бы начать с этого примера.

Как скопировать всю папку с помощью wix? или с чем он лучше всего справляется. Возможно, некоторые сжимаются с сторонним программным обеспечением.

EDIT:

Вот как мой файл 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

Должен признаться, я нахожу это довольно запутанным, если вы можете помочь мне, пожалуйста, на основе моего примера.

Спасибо.

+0

Я добавил изменение в свой ответ. Похоже, вам нужны только последние шаги для ссылки на ваш созданный теплом файл wxs в ваш wixproj. –

+0

1.Почему вы вручную сжимаете папку веб-приложения, а затем включаете ее в MSI? 2. Настройте скрипты wix, чтобы выбрать файлы, а затем скомпилируйте wix для генерации msi, который уже является сжатым файлом (вроде вашего gz-файла). – Isaiah4110

+0

Потому что легко скопировать один файл с установкой. Просьба привести пример копирования структуры. – eomeroff

ответ

2

Тепло - это только инструмент для сбора урожая, включенный в wix. Вы можете использовать его для сбора сотен файлов автоматически, если у вас есть структура каталогов на вашей машине сборки, которую вы хотите реплицировать на установочном компьютере.

Если ваши включенные файлы меняются довольно часто, настройка жаркой задачи для запуска каждой сборки - это то, что вы должны делать. Если включенные файлы являются довольно статичными, вы редко добавляете/удаляете или перемещаете некоторые файлы, используйте тепло для создания первого WXS со всеми файлами, а затем вручную обновляете его, когда это необходимо.

Не забывайте, что msi уже сжимает все файлы, которые он включает, нет причин сжимать все файлы в zip, а затем включать их в свой msi, чтобы распаковать его после «установки». Вы просто в конечном итоге занимаете слишком много места на машине клиента и могут не выполнить установку, так как MSI не может должным образом выполнить калькуляцию файлов и может закончиться дисковое пространство при распаковке.

Вы также отказываетесь от всех полезных функций отслеживания и обработки файлов установщика Windows при использовании ZIP-файла, содержащего все ваши файлы. Деинсталляция требует дополнительных шагов, обновление в принципе невозможно сделать красиво. Вы не можете откатиться во время сбоя.

Я собираю справочник «помощь» для нашего продукта с задачей «BeforeBuild» моего wixproj.

У меня есть файл genComponents.цели, которая содержит

<?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, который будет генерировать WXS для группы компонентов BinHelp для каталога со всеми файлами справка. Существует тысяча файлов справки для всех поддерживаемых нами языков.

В wixproj я добавляю wxs в качестве ссылки и просто слежу за тем, чтобы он включался в функцию как ComponentGroupRef.

Вы можете просто включить задачу Exec > в задание перед сборкой со всеми правильными аргументами. Я просто использую второй файл, потому что у меня много жарких задач. Есть много разных аргументов для нагрева, и вы можете взглянуть на них с помощью тепла /? видеть их.

Просто запустите heat.exe в своем каталоге js и посмотрите, как он выглядит.


В одном проекте, где я урожай все файлы с высокой температурой имеет 3836 файлов в нем. Вот процесс сборки. Я беру zip-файл из встроенных двоичных файлов и других файлов из сетевого расположения и разархивируйте все содержимое файла в папку, которую я назвал ZipFolder.

В моем wixproj я поставить вызов тепла в перед тем цели для построения

<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 файла в виде ссылки (маленькая стрелки на кнопке Добавить показывает падение вниз " as link ")

Я использую несколько переключателей линии cmd, которые вы не указали в своем тепловом вызове, который я использую, чтобы правильно ссылаться на компоненты сгенерированного файла. Во-первых, я использую -var var.ZipFolderDir, и это делает ваш файл равным $ (var.ZipFolderDir) \ rest \ of \ path.dll. И вы можете просто определить эту переменную в ваших defineconstants (для каждой конфигурации):

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

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

Другая разница также с помощью -dr INSTALLFOLDER, который будет установлен в каталог верхнего уровня, чтобы быть INSTALLFOLDER, который определяется вашей директории INSTALLFOLDER в product.wxs.

Наконец, существует -cg SDK, определяющее название группы компонентов, которая содержит все файлы, собранные при нагревании. Вот где мы связать с основной product.wxs с ComponentGroupRef

<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> 

И вы можете удалить ProductComponents группы в нижней части product.wxs

Я никогда не использовал <HarvestProject>, но я знаю, что у wix есть цели урожая, которые уже определены, но я никогда не тратил время, чтобы выяснить, как их использовать. Я также никогда не использовал тепло в проекте, так что я действительно не могу помочь. Все мои проекты установщика построены как их собственные отдельные проекты из-за процесса сборки, который мы используем. Обычно они захватывают ZIP-файлы и разархивируются в папку Binaries, а затем устанавливают инсталляторы, вызывающие нагрев в некоторых папках.

+0

Прошу прощения за поздний ответ, у меня не было времени проверить это раньше. Я добавляю редактирование на свои вопросы. Пожалуйста, смотрите. Благодарю. – eomeroff

+0

Завтра я добавлю редактирование на свой пост. У меня есть проект, который занимает довольно большой zip-файл, а затем распаковывает, а затем использует файл heat.exe на распакованном каталоге, который я включаю в мой установщик. –

+0

Мне очень жаль, что я занят, чтобы применить ваш ответ, я скоро это сделаю вам большое спасибо. – eomeroff

Смежные вопросы