views:

136

answers:

3

I have a software product that is used by two customers. There is one codebase, the only difference is that each customer has their logo on the product. My question is, what is the best way to manage the codebase so that I can easily build the project for each customer, and never use the wrong logo?

I currently have both images in a directory, modify code to point to the correct image for the appropriate customer and build in VS. Obviously not very efficient.

What I would like to do is have some sort of value in the build process so that it knows which image to use. That way I am not editing code each time I need to do a build. I am sure this is possible but am unsure how to go about doing this.

Any advice or pointers would be most appreciated.

Thanks, Will

+1  A: 

One obvious possibility is to have two different build configurations, each of which specifies a different preprocessor symbol. Then you can do:

#if CUSTOMER1
   const string LogoResource = "customer1.jpg";
#elif CUSTOMER2
   const string LogoResource = "customer2.jpg";
#else
   #error Must specify CUSTOMER1 or CUSTOMER2
#endif

Somewhat ugly, but it would work...

Jon Skeet
A: 

you could place the images in a seperate (resource-only) dll, eg customer1.dll and customer2.dll (or you could use the same names which makes the loading easier) and only ship the corresponding dll to each customer. At application startup, load the image from the dll and use it. This makes a pretty extensible system.

stijn
A: 

Maybe look at the problem domain from a different angle.

Typically you don't want to rebuild you project for each client - the only way around this is to load the image dynamically during runtime.

Generally I would make the image path user specified in a settings file, and load the image during runtime. This would avoid any complicated build settings, etc. as well as giving you the added benefit of scalibility if your client base continue to grow.

Mark Pearl