#if debug & # 8594; #if myOwnConfig?

Is there a way in Visual Studio to use custom configuration like "#if DEBUG"

I need "#if OFFLINE" since my Build-Config name is "Offline" (for further debugging purposes) ...

Thank!

+62
debugging c # visual-studio
Aug 26 '13 at 9:50
source share
3 answers
  • Build β†’ Configuration Manager β†’ Active Solution Configuration β†’ Create ...
  • Create a new "Offline" configuration.
  • Project β†’ Properties β†’ Assembly β†’ Configuration β†’ Offline
  • Conditional Compilation Symbols: Type OFFLINE
  • Save the project.
+96
Aug 26 '13 at 9:57 on
source share

Yes, you can. But before you can, do the following:

  • In Visual Studio, open Properties β†’ Build.
  • Select "Offline" from the configuration drop-down list.
  • Add "OFFLINE" to the "Conditional Compilation Symbols" text box

If you skip these steps, your #if OFFLINE will not work, because in this case OFFLINE is undefined.

+33
Aug 26 '13 at 9:55 on
source share

I followed the same steps as above. But they do not work. They skip one step, or they don’t explain it clearly.

When you do step 4. Conditional compilation characters: type OFFLINE. You also need to clear the "Define DEBUG constant" checkbox. Otherwise, the new OFFLINE character will not work.

I posted it here if someone spent a lot of time on me when I tried to do the same.

+7
Feb 20 '18 at 17:23
source share



All Articles