tags:

views:

68

answers:

2

Hi,

I am building a modular project and am looking for the best way to enable us to build multiple skews of this product for different customers. It needs be to done inside the build process so as not to allow the customer to change the value in a config file to enable a module.

My best guess would be some kind of set of environment variables associated with a specific build. Any advice?

+3  A: 

Are modules in separate dlls? The two approaches I can think of are:

  1. Use conditional compilation statements in the places where you include the modules + set create multiple configurations that will set the correct variable values (e.g. Release_A, Release_B, etc.). This can be tricky if modules are in separate dlls, I am not sure how the references would be handled
  2. Write a simple plugin architecture to dynamically load modules based on the config file. This only works when modules are in separate dlls - you ship only the dlls customer has paid for, so they can't really enable anything useful using the config file.
Grzenio
+1 for the plugin approach. It's so easy to do in .NET, and allows for other customization as well.
Lucero
+1  A: 

Conditional compilation is one option.

<shameless plug>

I wrote a brief article on conditional compilation with some samples.

</shameless plug>

I won't describe it again, Grzenio gives a good summary, check out his answer.

Simon P Stevens