Reputation: 4023
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
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:
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