Need different icons with different builds in C #

We have a product, but we are rebranding, so we need to be able to create and maintain two versions. I used resource files in conjunction with some #if materials to solve strings, images, and everything else, but the program icon gives me problems. I could not figure it out from msdn or google search. Thank!

+3
source share
3 answers

Do you mean the application icon? You can manually edit the project file and enter a code similar to the following:

<PropertyGroup>
  <ApplicationIcon Condition=" '$(Configuration)' == 'Version1' ">Icon1.ico</ApplicationIcon>
  <ApplicationIcon Condition=" '$(Configuration)' == 'Version2' ">Icon2.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Version1' ">
  <Content Include="Icon1.ico" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Version2' ">
  <Content Include="Icon2.ico" />
</ItemGroup>
+2
source

, , . ( , ), .

, , - . debug.ico release.ico app.ico. , , . , .

: , , . MiscUtil - .NET 2.0 3.5, . , .

+1

, . (, DebugOld.app.ico DebugBranded.app.ico, ReleaseBranded.app.ico)

:

copy "$(ProjectDir)$(ConfigurationName).app.ico" "$(ProjectDir)app.ico"
+1

Source: https://habr.com/ru/post/1698544/


All Articles