0

I'm working on a web site project on vb.net - asp.net 4 - visual studio 2010.

I need to implement a part of code that is used only when debug compilation is chosen within visual studio, e.g.:

' do something
#if DEBUGCONST
' debug mode! do something else
#end if
' proceed as usual..

Unfortunately this is not a web application project, therefore it doesn't come with a complete "property page" (where you can change compilers constant easily).

Googling for an answer, I found: http://msdn.microsoft.com/en-us/library/a15ebt6c%28v=vs.100%29.aspx

..and I changed my web.config in this way:

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

Unfortunately, even if it compiles fine, the DEBUGCONST is never defined and the "debug code" is never executed.

Is there something I'm missing?

Thank you in advance for any help!

Desmond
  • 567
  • 1
  • 7
  • 17
  • Instead try somethin like this: `If System.Diagnostics.Debugger.IsAttached Then ...` – Steve Oct 21 '13 at 15:28
  • does your approach works when the website is compiled using the "Debug" configuration but is been just "executed" (i.e., not debugged within Visual Studio)? – Desmond Oct 22 '13 at 08:24
  • Why dont you test it out? Should only take a second to test. – Steve Oct 22 '13 at 13:59
  • Thanks for your help and sorry for the late reply. I converted my project to Web application type, and this let me to define some compilation variable as I was trying to do. – Desmond Nov 11 '13 at 11:23

0 Answers0