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

Francis ANDRE francis.andre.kampbell at orange.fr
Fri Oct 30 12:47:06 PDT 2015



Le 30/10/2015 20:13, Edwin Castro a écrit :
> I don't fully understand what you are trying to do. You have a file that
> you want to appear in the MSI's File table (which will be installed) but
> you don't want WiX to look for it at build time? OR do you want to install
> the file only on some versions of your product (in other words, you do not
> want the file in the MSI's File table because the file is not to be
> installed)?
When the file exists, I want it included into the msi and installed
When the file does not exist, I do not want an error message from Light 
stating that the file is missing

I would like something like below with a new attribute: optional

<File optional="true" Id="FOO.HTML" Name="Foo.html" Source="foo.html"/>

There are zillions of html files and some of them disappears from one version to the next. So, I need an simpleway to not bother for those missing files without having to chekc the version with an if/then/else.

If this functionality is already present in Wix 3.10, I would like to know the how-to

Best

FA


>
>
> On Fri, Oct 30, 2015 at 6:57 AM, Francis ANDRE <
> francis.andre.kampbell at orange.fr> wrote:
>
>> Hi
>>
>> I am a new comer to WiX and using heat as you explained is too much
>> different from what I am using now with Candle/Light. I would expect
>> something like a optional attribute on the File element to avoid such
>> error...
>>
>>
>> Le 30/10/2015 14:23, Phill Hogland a écrit :
>>
>>> 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/
>>>
>>> ____________________________________________________________________
>>> WiX Toolset Users Mailing List provided by FireGiant
>>> http://www.firegiant.com/
>>>
>>>
>> ____________________________________________________________________
>> WiX Toolset Users Mailing List provided by FireGiant
>> http://www.firegiant.com/
>>
>
>




More information about the wix-users mailing list