Jeroen
Jeroen

Reputation: 4023

VS2008 deployment of same project but different compilations

I have 1 vs2008 solution that i need to deploy for 3 clients. Each client has a hardcoded setting and it's own app icon so i compile 3 versions.

What i do now each time is change the app icon, change the client's setting in my code and compile for each client. I want to avoid those steps each time.

Is there a way i can compile once and get 3 executables in 3 folders or with different names? Or have 3 projects sharing the same code?

Upvotes: 1

Views: 97

Answers (1)

Yoopergeek
Yoopergeek

Reputation: 5642

As hinted at in Josh's comment: this sounds like a job for application configuration settings. Going this route, the code doesn't need to change for each compile, just the deployed configuration file.

However, in the interest of answering your question as-is, you could use the Configuration Manager (Build menu -> Configuration Manager) to define seperate Solution Configurations. Out of the box you get a Debug and Release configuration, but there's nothing stopping you from creating your own. In these configurations, you could define an additional compilation symbol/constant in your project's Build settings, and then, in your code, using that constant, change your code, so, let's:

  1. Define three solution configurations Debug_A, Debug_B and Debug_C.
  2. Switching to Debug_A, open project properties, and on the Build tab define "DEBUGA" as an additional Conditional compilation symbol. (Repeat for Debug_B and Debug_C with their own constants.)
  3. Finally, in code:

    string configValue = string.Empty; Image icon = null; #if DEBUGA configValue = "A"; icon = Resources.IconA; #elsif DEBUGB configValue = "B"; icon = Resources.IconB; #elsif DEBUGC configValue = "C"; icon = Resources.IconC; #endif

Upvotes: 1

Related Questions