[wix-users] Wix 3.10.1.2213: How to avoir an error on missing files?
Francis ANDRE
francis.andre.kampbell at orange.fr
Sat Oct 31 04:01:00 PDT 2015
Thank you guys for your well commented advises... So I will have a look
at Harvest
Le 30/10/2015 22:10, Phill Hogland a écrit :
> Just copying the HarvestDirectory code that I already posted into your project, and setting the path, is about as simple of a solution as it gets. I suppose that you could also write a CompilerExtension to implement your idea of a File/@Optional attribute, but that seems like a lot more complex, which probably leaves you with whatever behavior MSI is going to do when the Component rules are ignored.
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Edwin Castro
> Sent: Friday, October 30, 2015 4:03 PM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] Wix 3.10.1.2213: How to avoir an error on missing files?
>
> Marking a File as optional would actually require the owning Component to be optional because the Component Rules dictate that Components must not change. If you do not want a Component in your MSI, then don't reference it.
>
> One way to tackle this problem is to group the Components for your zillion html files into a ComponentGroup and then use <?if?> to decided whether you reference the ComponentGroup or not. This approach works best if the files can be included or not in the MSI as a group. You could make smaller groups to get more fine grained control but becomes difficult the finer control needed.
>
> If the files are very dynamic (perhaps they are generated), then you'd want to use Heat to generate your WiX source for those files. Heat will generate ComponentGroups that you can reference. You will need to run heat before you run candle/light. The benefit here is that you can choose a static ComponentGroup Id and always reference it in your project because heat will generate an empty ComponentGroup if nothing is harvested.
>
>
> On Fri, Oct 30, 2015 at 12:47 PM, Francis ANDRE < francis.andre.kampbell at orange.fr> wrote:
>
>>
>> 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/
>>>>
>>>>
>>>
>> ____________________________________________________________________
>> WiX Toolset Users Mailing List provided by FireGiant
>> http://www.firegiant.com/
>>
>
>
> --
> Edwin G. Castro
>
> ____________________________________________________________________
> 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