Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7007281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:35:13+00:00 2026-05-27T21:35:13+00:00

I’m using Wix 3.6 beta from the command line, not as VS projects. I

  • 0

I’m using Wix 3.6 beta from the command line, not as VS projects. I have a web application that is harvested with heat as a directory. This works. I’m using web.config transforms to manage each of the target environment web.config files. These are output with msbuild, this works and keeps things visible in Visual Studio and source control.

I’ve hit a problem deploying one of the several web.config files which I am manually including in product.wxs as components with conditions. I was expecting to include all components as deployable features and let the conditions select just one as active. For example:

        <DirectoryRef Id="wwwroot">
        <Component Id="setup_a" Guid="some_guid" >
            <File Source="$(var.ConfigSourceDir)\setup_a\web.config"  />
            <Condition>ENVIRON = setup_a</Condition>
        </Component>

        <Component Id="setup_b" Guid="some_guid" >
            <File Source="$(var.ConfigSourceDir)\setup_b\web.config" />
            <Condition>ENVIRON = setup_b</Condition>
        </Component>

This didn’t create any file renaming, moving or deleting issues, but has the very fundamental problem that multiple web.config files are mapped to the same destination and this gives me a light error of “Product.wxs(xxx) : error LGHT0091 : Duplicate symbol ‘File:web.config’ found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.”

An alternative approach was to use different named .config files and rename/move one to be the web.config, so something like:

        <DirectoryRef Id="wwwroot">
                <Component Id="setup_a" Guid="some_guid" >
                <File Id="setup_a.config" Source="$(var.ConfigSourceDir)\setup_a.config"  />
                <CopyFile Id="moveit" SourceDirectory="wwwroot" SourceName="setup_a.config" DestinationDirectory="wwwroot" DestinationName="web.config"  />
               </Component>

This doesn’t throw an error, bot the CopyFile command does nothing at all. I just get setup_a.config in the wwwroot folder.

If I nest the CopyFile inside the File, the copy action then works:

        <DirectoryRef Id="wwwroot">
               <Component Id="setup_a" Guid="some_guid" >
               <File Id="setup_a.config" Source="$(var.ConfigSourceDir)\setup_a.config"  >
                    <CopyFile Id="moveit" DestinationName="web.config"/>
               </File>
               </Component>

…but nested CopyFile means I can’t add (it’s disallowed) the Delete=”yes” attribute to create a ‘move’ action. Instead I’m left with both setup_a.config and web.config in the wwwroot folder. Alternatively, if I add a seperate removefile within the same component element it also does nothing:

<RemoveFile Id="removefile" On="install" Directory="wwwroot" Name="setup_a.config"/>
</Component>

So, I’m hoping for a working example of how handle multiple web.config files in a conditional deployment, that doesn’t leave files behind. the destination filename of web.config is fixed by the framework and can’t be changed. The different configs are also pre-generated outside of wix using config transforms, this also can’t be changed but the generated filenames could be anything.

cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:35:13+00:00Added an answer on May 27, 2026 at 9:35 pm

    You complicate it too much. This should work:

        <Component Id="setup_a" Guid="some_guid" >
            <File Name="web.config" Id="config_a" Source="$(var.ConfigSourceDir)\setup_a\web.config"  />
            <Condition>ENVIRON = setup_a</Condition>
        </Component>
    
        <Component Id="setup_b" Guid="some_guid" >
            <File Name="web.config" Id="config_b" Source="$(var.ConfigSourceDir)\setup_b\web.config" />
            <Condition>ENVIRON = setup_b</Condition>
        </Component>
    

    Pay attention to a couple of things here:

    • the File/@Name is the same – that’s the target file name you’d like to have (web.config)
    • the File/@Id is different for each File in order to avoid the light error you mentioned first
    • the File/@Source can be anything – it just describes what file to take as a source

    In this sample light will still complain with warning LGHT1076, but that’s just a warning – it pays your attention that conditions MUST be mutually exclusive to avoid problems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.