I have Website Project in Visual Studio 2013. I have two Publishing Profiles, one for staging and the other for production. In Configuration Manager, I can create new Active Solution Configurations but cannot add new Configurations to my drop-down, Debug is the only option.
So now when I attempt to Publish using my production profile, the web.config is getting transformed by both the Web.Debug.Config and my web.Production.Config.
How do I add new Configurations to the dropdown?
How do I add new Configurations to the dropdown?
You can't. At least not for the purpose you need to use these new configurations for.
I'll make the assumption that you really need to know this:
How can I publish a web site without the
debug
flag being applied to theweb.config
by the debug transform?
This is already happening, just in a confusing way.
When you publish the site using the Publish Web Site wizard it applies the appropriate transforms to the web.config
. In your case, Web.Debug.Config
and Web.Production.Config
.
And now for the confusing part:
By default, web.debug.config
actually removes the debug
attribute from the web.config
.
<compilation xdt:Transform="RemoveAttributes(debug)" />
This happens for legacy reasons to do with the missing Web Site project file and the underlying build tools.
If you want to stop the debug transformation being applied and you have no custom configuration in it, you can delete web.debug.config
. Just be sure to add
<compilation xdt:Transform="RemoveAttributes(debug)" />
inside the <system.web>
element of each of your environment specific transforms (web.Production.Config
, etc).
My recommendation is:
web.debug.config
untouched. In its default state.web.<configuration>.config
)To get my publish settings working the way I wanted I had to:
Since all publish profiles in a website project seem to be stuck on a debug configuration, there was no way for me to avoid web.debug.config transforming my default web.config. With this solution, we simply don't use web.config for publish specific transforms.
I'd like to credit Chris O'Neill for his helpful, if verbose, answer that clued me into this solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With