This is probably a quick question. I'm very new to solution configurations and web.config xml file transformations. I wanted to add a transformation to set the debug attribute for the compilation element of an Asp.Net Mvc website to true:
Web.Debug.config:
<system.web>
<compilation debug="true" xdt:Transform="SetAttributes(debug)" />
</system.web>
Web.config:
<compilation targetFramework="4.0">
<assemblies>
...
</assemblies>
</compilation>
but when I press F5, a window pops up in Visual Studio saying "The page cannot be run in debug mode because debugging is not enabled in the web.config file." It then gives me the option to alter the Web.config file. But I thought the point of the Web.Debug.config file was to allow this to get set automatically... Can I get Visual Studio to use the transformed Web.config file after pressing F5?
Many thanks in advance!
Andrew
Okay, I've decided to use the following setup instead:
Web.config:
<configuration>
...
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
...
</assemblies>
</compilation>
</system.web>
...
</configuration>
Web.Release.config:
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation debug="false" xdt:Transform="SetAttributes(debug)" />
</system.web>
</configuration>
This should cause the compilation debug attribute to get overwritten with "false" when the build deployment configuration is set to "release".
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