0

I have a single desktop app project in Visual Studio which need to be built with a number of different app icons. I have added support for this in the project-file like so:

<PropertyGroup>
  <ApplicationIcon Condition=" $(DefineConstants.Contains('OTHER_VERSION')) ">Other.ico</ApplicationIcon>
  <ApplicationIcon Condition=" !$(DefineConstants.Contains('OTHER_VERSION')) ">Standard.ico</ApplicationIcon>
</PropertyGroup>

Now, how do I configure my project to build both these versions automatically at the same time, without having to execute the build twice and change build constants in between? Is it even possible?

Andreas Zita
  • 7,232
  • 6
  • 54
  • 115

2 Answers2

0

The simplest way would be to create a copy of your project file, modify the build configuration however you want (output path, Assembly Name, etc...) add this modified project file to your solution and build. It will look like you have two projects in your solution, but they will reference the same files.

Your other option would be to simply write your own build script that calls msbuild passing a different configuration on each call which will result in multiple builds being created.

gmiley
  • 6,531
  • 1
  • 13
  • 25
  • Thanks! Cloning the csproj-file worked fine. With the minor drawback that it will be a little hard to maintain when adding/removing files or doing other project changes that need to be replicated to all proj-files. Your other suggestion would mitigate that. – Andreas Zita Jan 09 '18 at 13:39
0

Another solution could be to create a post build action to copy the output executable and edit the icon from executable. This is possible in opening exceutable file with Visual Studio (Open->File...->Select "Executable Files" type) then it must be possible with code or script.

cf this question

Troopers
  • 5,127
  • 1
  • 37
  • 64