Search code examples
asp.net-mvcthemesconditional-compilationwhite-labelling

How do I "White Label" my ASP.Net MVC Application?


I have a "white labelled" application that is installed onto multiple customers' servers. On any given installation the differences will include content, style sheets and graphics but also some actual code / business logic. I want my TFS Server to build all flavours of my application automatically. What are my options for doing this? e.g. should I be using Themes? What about #if conditional compilation flags.

P.S. The question is not about how to setup the Build Server - I've done that already.


Solution

  • For the business logic I would abstract the differences into a separate libraries, and then you can use an IoC / DI pattern or provider pattern to resolve the correct business logic at runtime.

    As for the content I would look into themes. Essentially you could have your build server build all the code once, then when you package the code you choose which assemblies you need and use the appropriate configuration, and choose the appropiate theme folder for the client at hand.

    I don't like using # directives in this case. If you think about it your unit tests would have to run for each conditional you have. If you remove the conditionals and abstract the differences your unit tests can just run on all the pluggable assemblies at once.