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

  • SEARCH
  • Home
  • 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 6828251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:21:40+00:00 2026-05-26T22:21:40+00:00

Is it possible to have some preprocessor directive constants for different files in different

  • 0

Is it possible to have some preprocessor directive constants for different files in different projects in visual studio 2010 ? Here is an example of what I’m trying to do:

In file “1” in project “A” I define: TIMEDISPLAYING

 #define TIMEDISPLAYING

in file “2” in project “B” I check for TIMEDISPLAYING:

 #if TIMEDISPLAYING
        //do something
 #else
        //do something else
 #endif

I know in the project file I can add my custom constants. Is there somewhere in the solution file where I can add something similar? Or some other type of file that imports all of my custom constants?

I currently have boolean constants defined in one class, but I would like my code compiled based on the constants and DEBUG is not enough for me. My next solution would be to just add my boolean constants if DEBUG is defined:

 #if DEBUG
           protected const bool ISTIMEDISPLAYING = 1 == 1;

           protected const bool ISDATARANDOM = 1 == 0;

           protected const bool IS_AUTO_LOADING_CHAMP_VENDOR = 1 == 1;

           protected const bool IS_TESTING_PO = 1 == 0;
 #endif

Is there any alternative solution to my last one here? Any help greatly appreciated.

  • 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-26T22:21:41+00:00Added an answer on May 26, 2026 at 10:21 pm

    You can set conditional compilation symbols on the Build tab of your project properties in Visual Studio instead of declaring them in the code. Different build configurations can have different conditional compilation symbols assigned, and you can create as many build configurations as you need. This is probably easier to manage, and you don’t have to worry about which source file to add them to because they’re stored in the project itself.

    You might also find the Conditional attribute useful if you wish to include or exclude a whole method based on a conditional compilation symbol.

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

Sidebar

Related Questions

Possible Duplicate: Avoiding repeated constants in CSS We have some theme colors that are
Is it possible in Eclipse to have some kind of packages (sets of projects)
Is it possible to have a conditional installation configuration, slaved wth the Visual Studio
I have some sql statements that calculates some numbers. It's possible (with bonus points/penalty
I have some thread-related questions, assuming the following code. Please ignore the possible inefficiency
I'm not even sure if it's possible but say I have some XML: <source>
In an iPhone application, I have some plain C functions. Is it possible to
Is it possible to have something like a JTextArea which will color some keywords
Possible Duplicate: Best way to stop SQL Injection in PHP I have seen some
I have been checking out some of the possible timers lately, and System.Threading.Timer and

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.