Generate Web.Debug.config which could be debugged

本小妞迷上赌 提交于 2020-01-13 07:27:23

问题


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 theWeb.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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!