C# VS 2008 Build Configurations - using different classes for different builds

Posted by evan on Stack Overflow See other posts from Stack Overflow or by evan
Published on 2010-06-09T18:02:13Z Indexed on 2010/06/09 18:12 UTC
Read the original article Hit count: 192

I'm writing an application which has two classes that provide basically the same functionality but for different situations. I'd like to have three versions of the software - one where the user can change an ini file to configure the program to use one of the two classes, and then one version that only uses one of the two classes.

Right now I have it working via an ini file, but I'd like to be able to build versions that don't include the code for the unneeded class at all.

What is the best way to go about this? My current line of thinking is that since both classes derive from a common interface I'll just add a compile time conditional that looks at the active build configuration and decides whether to compile that class. What is the syntax to do that?

Thanks in advance for your help and input!

© Stack Overflow or respective owner

Related posts about c#

Related posts about visual-studio-2008