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 8578229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:20:21+00:00 2026-06-11T20:20:21+00:00

I am using web.config transformations to insert entries into the web.config for certain build

  • 0

I am using web.config transformations to insert entries into the web.config for certain build configurations.

E.g. my Web.Test.config has this entry:

<elmah>
    <errorMail from="me@me.com" to="me@me.com" async="false" smtpPort="25" smtpServer="mail" subject="test.senegal.co.uk Exception" xdt:Transform="Insert" />
</elmah>

This works absolutely fine building from visual studio.

However when creating a deployment package using msbuild, the entry is duplicated in the web.config. This obviously causes an exception.

Any ideas?

UPDATE

My “master” config is Web.Master.config not Web.config. The web.config file gets overwritten on build in visual studio. I think it must have something to do with this.

What I think is happening is msbuild is transforming web.config rather than using the Web.Master.config.

The question is how to tell it to use the right master.

  • 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-06-11T20:20:23+00:00Added an answer on June 11, 2026 at 8:20 pm

    I added /p:TransformWebConfigEnabled=false to the msbuild parameters, as my web.config was already being transformed in a BeforeBuild target like so:

    <Target Name="BeforeBuild">
       <TransformXml Source="$(MSBuildProjectDirectory)\Web.Master.config" Transform="$(MSBuildProjectDirectory)\Web.$(Configuration).config" Destination="$(MSBuildProjectDirectory)\Web.config" />
    </Target>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got 3 connectionstrings in web.config, and I used theirs like this: using (SqlConnection
I have an C# asp.net app using the default Sql MembershipProvider. My web.config has
I'm using the SlowCheetah XML Transforms extension to handle web.config-like transformations with app.config. That
I created a test project using a web.config file by renaming it to same
I'm trying to accomplish this using web.config and it worked fine when I had
I'm using the web.config transformations on an ASP.NET site so I have .config settings
I'm trying to get web.config transformations working as described here . We've used this
The session state timeout is set using this web.config element <sessionState mode=InProc cookieless=false timeout=120
My asp.net app has is using a web.config for common configuration. I also have
I'm trying to develop my first web application using Web.Config transformations. Trying to run

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.