Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 566277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:57:36+00:00 2026-05-13T12:57:36+00:00

In Solution properties, I have Configuration set to release for my one and only

  • 0

In Solution properties, I have Configuration set to “release” for my one and only project.

At the beginning of the main routine, I have this code, and it is showing “Mode=Debug”.
I also have these two lines at the very top:

#define DEBUG 
#define RELEASE

Am I testing the right variable?

#if (DEBUG)
            Console.WriteLine("Mode=Debug"); 
#elif (RELEASE)
            Console.WriteLine("Mode=Release"); 
#endif

My goal is to set different defaults for variables based on debug vs release mode.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:57:37+00:00Added an answer on May 13, 2026 at 12:57 pm

    DEBUG/_DEBUG should be defined in VS already.

    Remove the #define DEBUG in your code. Set preprocessors in the build configuration for that specific build.

    The reason it prints “Mode=Debug” is because of your #define and then skips the elif.

    The right way to check is:

    #if DEBUG
        Console.WriteLine("Mode=Debug"); 
    #else
        Console.WriteLine("Mode=Release"); 
    #endif
    

    Don’t check for RELEASE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my solution has multiple projects and in one of them I have the code
I have a solution consisting of several library project and one application project. I
I have a project configured for Any CPU. When I go to solution properties,
I have inherited a VC++ solution and from one project (named IntersonWinDriver) I'm trying
I have a C++ solution in VS2008 with multiple projects. This solution contains files
I have an application that uses several configuration files (let just consider appli.properties here).
Does anybody have a good solution for managing .properties files in a web application?
In my properties file I have one property, which contains a comma separated list
I have a project where I need to construct a fair amount of configuration
I have several Windows Service projects in one solution in Visual Studio 2010, they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.