Search code examples
c#visual-studiodebuggingbuildconfigurationbuildconfig

#if debug --> #if myOwnConfig?


is there a way in Visual Studio to use a custom Configuration like "#if DEBUG"

I need a "#if OFFLINE" as my Build-Config's name is "Offline" (only for further debug-purposes too)...

Thanks!


Solution

  • Yes, this is possible.

    Instructions:

    1. Build -> Configuration manager -> Active solution configuration -> New...
    2. Create a new configuration named: Offline.
    3. Project -> Properties -> Build -> Configuration -> Offline.
    4. Conditional compilation symbols, type: OFFLINE.
    5. Save project.
    6. Restart Visual Studio (reloading the project is not enough).