How to program three editions Light, Pro, Ultimate in one solution

Posted by Henry99 on Stack Overflow See other posts from Stack Overflow or by Henry99
Published on 2010-05-31T10:36:47Z Indexed on 2010/05/31 10:43 UTC
Read the original article Hit count: 211

Filed under:
|
|
|

I'd like to know how best to program three different editions of my C# ASP.NET 3.5 application in VS2008 Professional (which includes a web deployment project). I have a Light, Pro and Ultimate edition (or version) of my application. At the moment I've put all in one solution with three build versions in configuration manager and I use preprocessor directives all over the code (there are around 20 such constructs in some ten thousand lines of code, so it's overseeable):

#if light
//light code
#endif
#if pro
//pro code
#endif //etc...

I've read in stackoverflow for hours and thought to encounter how e.g. Microsoft does this with its different Windows editions, but did not find what I expected. Somewhere there is a heavy discussion about if preprocessor directives are evil.

What I like with those #if-directives is:

  • the side-by-side code of differences, so I will understand the code for the different editions after six months
  • and the special benefit to NOT give out compiled code of other versions to the customer.

OK, long explication, repeated question: What's the best way to go?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET