Sign in to follow this  

[.net] C# Preprocessor checking what solution name is?

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to have the C# preprocessor check what the solution name is? I wanna do something like #if SOLUTIONNAME="Client" callfunction(); #endif Thanks. -Nick

Share this post


Link to post
Share on other sites
Quote:
Original post by Krisc
Wouldn't he have to define it using #define CLIENT, then?
Either that or, in VS2005, right click on your project, goto Properties. Change to the Build tab and add "CLIENT" to the Conditional compilation symbols. You add multiple symbols by using a semi-colon.

This is the same method used with #if DEBUG [wink].

Share this post


Link to post
Share on other sites
I'm not sure why you're doing this at the pre-processor stage - perhaps becuase the function is in an unreferenced assembly in some solutions ? Anyhow, if you need to do this at runtime I tend to use GetExecutingAssembly and check its name.

Phillip Hamlyn

Share this post


Link to post
Share on other sites

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this