问题
I have a web role Its web.config has a following lines
<system.web>
<compilation debug="false" targetFramework="4.5.1" />
When I want to debug my role each time I need to switch that option to true
.
Can I generate only for debug web.config with debug="true"?
While compiling I have see the transforming step:
Transformed Web.config using C:\data\Main\WebRole\Web.Debug.config into C:\data\Main\obj\x64\Debug\WebRole.csproj\TransformWebConfig\transformed\Web.config.
Can I customize the above transformation? There is a guidance http://msdn.microsoft.com/en-us/library/vstudio/dd465318(v=vs.100).aspx for that purpose but I am not sure how to write a transformation for specific case
Ive defined the following transformation in the
Web.Debug.Config`
<system.web>
<compilation debug="true"
xdt:Transform="Replace">
</compilation>
</system.web>
I still can`t debug and asked to change the value manually
回答1:
The web.debug.config is not used when you are running/debugging from sources : Use Visual Studio web.config transform for debugging
It easier to set debug="true"
in Web.config
and remove it using Web.release.config
.
Sample Web.Release.Config :
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
来源:https://stackoverflow.com/questions/27401678/generate-web-debug-config-which-could-be-debugged