Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net vb.net网站项目中的自定义编译器内容_Asp.net_Vb.net_Visual Studio 2010_Debugging_Compiler Constants - Fatal编程技术网

Asp.net vb.net网站项目中的自定义编译器内容

Asp.net vb.net网站项目中的自定义编译器内容,asp.net,vb.net,visual-studio-2010,debugging,compiler-constants,Asp.net,Vb.net,Visual Studio 2010,Debugging,Compiler Constants,我正在vb.net-asp.NET4-VisualStudio2010上做一个网站项目 我需要实现仅在visual studio中选择调试编译时使用的部分代码,例如: ' do something #if DEBUGCONST ' debug mode! do something else #end if ' proceed as usual.. 不幸的是,这不是一个web应用程序项目,因此它没有一个完整的“属性页”(您可以轻松地更改编译器) 在谷歌上搜索答案,我发现: …我用以下方式更改了

我正在vb.net-asp.NET4-VisualStudio2010上做一个网站项目

我需要实现仅在visual studio中选择调试编译时使用的部分代码,例如:

' do something
#if DEBUGCONST
' debug mode! do something else
#end if
' proceed as usual..
不幸的是,这不是一个web应用程序项目,因此它没有一个完整的“属性页”(您可以轻松地更改编译器)

在谷歌上搜索答案,我发现:

…我用以下方式更改了我的web.config:

<system.codedom>
  <compilers>
    <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"  compilerOptions="/define:DEBUGCONST"></compiler>
  </compilers>
</system.codedom>

不幸的是,即使它编译得很好,也从未定义DEBUGCONST,也从未执行“调试代码”

有什么我遗漏的吗


提前感谢您的帮助

相反,请尝试以下方法:
如果System.Diagnostics.Debugger.IsAttached,那么…
当网站使用“调试”配置编译,但只是“执行”(即,未在Visual Studio中调试)时,您的方法是否有效?为什么不进行测试?只需一秒钟即可进行测试。谢谢您的帮助,很抱歉回复太晚。我将我的项目转换为Web应用程序类型,这让我能够像我试图做的那样定义一些编译变量。