Where I work we have a program that is used by our company. We then have another build of that same program that uses different data and different backgrounds, title text, etc. This all works fine, but since both are technically the same application the Application Icon is the same for both. We want separate icons for each build.
The Application icon is set in the project file: <ApplicationIcon>MyIcon.ico</ApplicationIcon>
Is there a way to have a different icon based on the build configuration? I know that the Condition
attribute is not valid for the <ApplicationIcon>
tag.
I tried right-clicking a project, choosing Properties, and clicking the Application tab. This is where you can change the icon file. However, the Configuration and Platform dropdowns are disabled. This confirms that if you can have different icon files for different builds, it's not going to be the easy way.
If you do any scripting to customize your build, you could 'preprocess' your
*.csproj
file, settingApplicationIcon
based on the desired build, then build the project.No you don't. Notice the parent <PropertyGroup /> tag? This indicates the ApplicationIcon tag is an MsBuild property so the Condition attribute would be valid in this case.
Heck, if your file names resolve to an MsBuild property value like they do above, you could infer the file name like so:
EDIT: Pretend the above uses and properly evaluates $(Configuration) property values rather than $(Platform)