生成可以调试的Web.Debug.config [英] Generate Web.Debug.config which could be debugged
问题描述
我有一个网络角色 其web.config包含以下几行
I have a web role Its web.config has a following lines
<system.web>
<compilation debug="false" targetFramework="4.5.1" />
每次要调试角色时,都需要将该选项切换为true
.
我能否仅使用debug="true"?
为调试web.config生成
编译时,我看到了转换步骤:
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.
我可以自定义上述转换吗? 有指南 http://msdn. microsoft.com/en-us/library/vstudio/dd465318(v=vs.100).aspx 用于此目的,但我不确定如何针对特定情况编写转换
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
I ve defined the following transformation in the
Web.Debug.Config`
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
推荐答案
从源代码运行/调试时,不使用web.debug.config:
The web.debug.config is not used when you are running/debugging from sources : Use Visual Studio web.config transform for debugging
在Web.config
中设置debug="true"
并使用Web.release.config
删除它更容易.
It easier to set debug="true"
in Web.config
and remove it using Web.release.config
.
示例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>
这篇关于生成可以调试的Web.Debug.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!