[wix-users] Wix 3.10.1.2213: How to avoir an error on missing files?

Phill Hogland phill.hogland at rimage.com
Fri Oct 30 06:23:11 PDT 2015


For situations like this I use heat.exe, specifically I prefer to use the wix supplied HarvestDirectory MSBuild target by adding something like this to myProject.wixproj file (or a harvest.targets file that I then import into the .wixproj file):

  <PropertyGroup>
    <HarvestNoLogo>true</HarvestNoLogo>
    <HarvestVerboseOutput>true</HarvestVerboseOutput>
    <HarvestAutogenerateGuids>true</HarvestAutogenerateGuids>
    <HarvestSupressFragments>true</HarvestSupressFragments>
    <HarvestSuppressUniqueIds>true</HarvestSuppressUniqueIds>
    
  </PropertyGroup>
  <ItemGroup>
    <HarvestDirectory Include="..\path\dir1">
      <DirectoryRefId>Dir1Id</DirectoryRefId>
      <Transforms>transfrom1.xslt</Transforms>
      <ComponentGroupName>Dir1Group</ComponentGroupName>
      <PreprocessorVariable>var.Dir1Var</PreprocessorVariable>
      <KeepEmptyDirectories>false</KeepEmptyDirectories>
      <SuppressCom>true</SuppressCom>
      <SuppressRootDirectory>true</SuppressRootDirectory>
      <SuppressRegistry>true</SuppressRegistry>
      
      <Visible>false</Visible>
  </HarvestDirectory>
  <HarvestDirectory Include="..\path\Dir2">
        <DirectoryRefId>Dir2Id</DirectoryRefId>
        <Transforms>transfrom2.xslt</Transforms>
        <ComponentGroupName>Dir2Group</ComponentGroupName>
        <PreprocessorVariable>var.Dir2Var</PreprocessorVariable>
        <KeepEmptyDirectories>false</KeepEmptyDirectories>
        <SuppressCom>true</SuppressCom>
        <SuppressRootDirectory>true</SuppressRootDirectory>
        <SuppressRegistry>true</SuppressRegistry>
        
        <Visible>false</Visible>
  </HarvestDirectory>
  </ItemGroup>

The generated wxs files end up in ..\obj\$(Configuration) and get added to the compile source list automatically.  A ComponentGroupRef needs to be added to the project's authoring.

And in most of my implementations, rather than using:
        <PreprocessorVariable>var.Dir2Var</PreprocessorVariable>
I use:
        <PreprocessorVariable>wix.Dir2Var</PreprocessorVariable>
And I also use a transform which substitutes '!(bindpath.' for '!(wix.' , which then allows me to add a named bindpath to my wixproj
    <LinkerAdditionalOptions>
      $(LinkerAdditionalOptions)
      -nologo
      -b Dir1Var="\\server\folder\Dir1_ToHarvest\\"
    </LinkerAdditionalOptions>






-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Francis ANDRE
Sent: Friday, October 30, 2015 5:32 AM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Wix 3.10.1.2213: How to avoir an error on missing files?

Hi

I am using a component  where some source files can be present or not when building the msi. How can be avoided the fatal error when the file is missing? Is there some kind of relax attribute?

Below is an example where I want to remove the test condition

                         <?if $(var.ProductVersion) =  1.6.1 ?>
                         <File Id="POCO.MONGODB.ELEMENTCOMPARATOR.HTML" 
Name="Poco.MongoDB.ElementComparator.html" 
Source="$(var.POCO)\releases\poco-$(var.VERSION)-all-doc\Poco.MongoDB.ElementComparator.html" 
/>
                         <?endif ?>

Thank for any help

Cheers

FA

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list