Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include all Files in Bin folder in Wix installer

Tags:

I'm new in Wix, I succefully create an MSI installer for my project, but my Bin folder have a lot of DLL's files with EXE main file, I want to include all these files with the installer

I found THIS solution, that seems right but unfortunately I can not accomplish this solution in my Wix file, Here's my Wix file:

<Product Id="*" Name="Setup"        Language="1033" Version="1.0.1.0"        Manufacturer="ORDER MS"        UpgradeCode="a4f0a0d0-ae64-4f62-9bb3-efa7e75072e0">  <Package InstallerVersion="200"          Compressed="yes"          InstallScope="perMachine" />  <MajorUpgrade Schedule="afterInstallInitialize"               DowngradeErrorMessage="A newer version of [ProductName] is already installed." />  <MediaTemplate />  <Feature Id="ProductFeature" Title="Setup" Level="1">   <ComponentGroupRef Id="ProductComponents" />   <ComponentRef Id="ApplicationShortcutDesktop" />   <ComponentRef Id="ApplicationShortcut" /> </Feature>  <Icon Id="Icon.exe" SourceFile="$(sys.CURRENTDIR)\icon.ico"/> <Property Id="ARPPRODUCTICON" Value="icon.exe" /> 



<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">   <Component Id="ProductComponent">     <File Source="$(var.Order.TargetPath)" />   </Component>    <Component Guid="A7C42303-1D77-4C70-8D5C-0FD0F9158EB4" Id="CopyComponent">     <CopyFile Id="SomeId"                SourceProperty="SOURCEDIRECTORY"               DestinationDirectory="CopyTestDir" SourceName="*" />   </Component>     </ComponentGroup> 

I get this Error:

Error 1 ICE18: KeyPath for Component: 'CopyComponent' is Directory: 'INSTALLFOLDER'. The Directory/Component pair must be listed in the CreateFolders table.

like image 251
Abdulsalam Elsharif Avatar asked Apr 20 '16 22:04

Abdulsalam Elsharif


People also ask

How do I create a folder in Wix?

Go to My Sites in your Wix account. Click Create New Folder at the top right. Enter a name for the folder and click Create.

How do I use heat EXE on Wix?

Basically the heat command generates a wxs file with the above component in it. Then all you need to do is to include this component or component group in your main installer. It will then create the registry entries instead of running regasm. The uninstall would then remove these registry entries.


Video Answer


1 Answers

This solution works with WIX 3.11.

To harvest an entire directory, you can use Heat from the WIX toolset. With Heat we can automatically include all files from a given source directory on every build. To do that we first need to edit the Setup.wixproj:

Define the Harvestpath for Heat:

<PropertyGroup>       <DefineConstants>HarvestPath=...\Deploy</DefineConstants> </PropertyGroup> 

Heat will create a .wxs file. So we need to add this file to the compile ItemGroup:

<ItemGroup>   <Compile Include="Product.wxs" /> <!-- This will be your default one -->   <Compile Include="HeatGeneratedFileList.wxs" /> <!-- This is the Heat created one --> </ItemGroup> 

Then execute Heat in the BeforeBuild build target:

<Target Name="BeforeBuild">   <HeatDirectory Directory="..\Deploy"      PreprocessorVariable="var.HarvestPath"      OutputFile="HeatGeneratedFileList.wxs"      ComponentGroupName="HeatGenerated"      DirectoryRefId="INSTALLFOLDER"      AutogenerateGuids="true"      ToolPath="$(WixToolPath)"      SuppressFragments="true"      SuppressRegistry="true"      SuppressRootDirectory="true" />   </Target> 

This will generate the HeatGeneratedFileList.wxs every time the WIX installer is built. The directory ..\Deploy has to be set to the directory of the files to include. The only thing we have to do to include these files in our installer is to edit the main .wxs file (like Product.wxs in this example). Heat will create a ComponentGroup with the given name from above. This component needs to be referenced in the Feature section of the Product.wxs:

<Feature Id="ProductFeature" Title="DiBA Tool" Level="1">   <...>   <ComponentGroupRef Id="HeatGenerated" /> </Feature> 
like image 73
darkend Avatar answered Oct 17 '22 12:10

darkend