想要在C#中使用不同构建的不同图标 [英] want different icons with different builds in C#
本文介绍了想要在C#中使用不同构建的不同图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们有产品,但我们正在进行一些品牌重塑,因此我们需要能够构建和维护两个版本。我使用资源文件和一些#if东西来解决字符串,图像和其他任何问题,但是程序图标给了我麻烦。我无法从msdn或谷歌搜索中找到它。谢谢!
We have a product but we are doing some rebranding so we need to be able to build and maintain two versions. I used resource files combined with some #if stuff to solve the strings, images, and whatever else, but the program icon is giving me trouble. I couldn't figure it out from msdn or a google search. Thanks!
推荐答案
您指的是应用程序图标吗?您可以手动编辑项目文件并输入类似于以下内容的代码:
Are you referring to the application icon? You can edit your project file manually and put in 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>
这篇关于想要在C#中使用不同构建的不同图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文