I'm trying to optionally include a file in my installer at compile/link time. 
If the file is included, then the installer will copy it to the appropriate 
location (thus it is not optional for the user to install it).  If the file is 
NOT included in the installer, then it the installer skips it, and it is not an 
error.

Is there a way to conditionally include a file in the installer?  My automated 
build system will takes care of the logic of determining whether or not the 
file should be included.

As an example, I have a single feature called "Configuration":
    <Feature Id="Complete" Title="Install" Level="1">
        <ComponentRef Id="Configuration" />
    </Feature>

In the component description, I have a config file that is required.  I've 
tried to add a second file (weather.lnk) that is optional:

      <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="CompanyFolderName" Name="MyCompany" >
           <Directory Id="INSTALLLOCATION" Name="MyApp">

            <Component Id="Configuration" 
Guid="175F0351-F122-4c64-92B6-BED06F22E195">
              <File Id="MyApp.exe.config"
                    Source="$(var.SourceRoot)\MyApp.exe.config" >
              </File>

              <File Id="Weather.lnk"
                    Source="$(var.SourceRoot)\Weather.lnk>
              </File>

            </Component>
          </Directory>
        </Directory>
      </Directory>
    </Directory>

If the Weather.lnk file does not exist in the given location, the linker gives 
a LGHT0083 error (file not found).  I'd like to annotate this file (if 
possible) as optional, or somehow put a conditional around it so if it is not 
found in the given location, it is not an error and is just skipped when the 
installer is compiled and linked.  And then assuming the successful build of 
the installer, when the installer is run, it will just skip this file.

Do I need to make a separate component or feature for this particular file?  
I've looked around at the descriptions of the File, Component, Feature items 
and didn't see anything that was obvious to me to make it optional.  I did find 
the "Vital" attribute for the File - I tried setting this to "no", but still 
got the link error.

Is this possible?
I'm using Wix 3.0
Thanks,
Beth



---------------------------------------------------------------------------
This email and any files transmitted with it are confidential & proprietary to 
Systems and
Software Enterprises, Inc. (dba IMS). This information is intended solely for 
the use of
the individual or entity to which it is addressed. Access or transmittal of the 
information
contained in this e-mail, in full or in part, to any other organization or 
persons is not
authorized.
---------------------------------------------------------------------------

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to