设置不同的ApplicationIcon每个构建配置 [英] Set a different ApplicationIcon for each build configuration

查看:163
本文介绍了设置不同的ApplicationIcon每个构建配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设置一个不同的图标为我的C#项目(使用VS 2010专业版)的每个生成配置。其中一个配置是针对不同的客户,因此该配置应该使用不同的图标

I'm trying to set a different Icon for each build configuration of my C# project (using VS 2010 pro). One config is for a different customer, thus that config should use a different icon.

我不知道为什么,这并不在文件的csproj工作:

I'm not sure why this doesn't work in the csproj file:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    ...blah...
    <ApplicationIcon>Images\RegularIcon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Customer|AnyCPU' ">
    ...blah...
    <ApplicationIcon>Images\CustomerIcon.ico</ApplicationIcon>
</PropertyGroup>



这是行不通的。真的不知道如果我在正确的轨道上。

It doesn't work. Not really sure if I'm on the right track.

一个令人沮丧的事情......如果我设置在Visual Studio中的图标,在属性 - >应用程序选项卡,它在文件的csproj创建此:

One frustrating thing... if I set the icon in Visual Studio with in the Properties->Application tab, it creates this in the csproj file:

<PropertyGroup>
    <ApplicationIcon>Images\foo.ico</ApplicationIcon>
</PropertyGroup>



为什么在这个匿名的PropertyGroup指定的图标得到遵守,但一个在我的条件的PropertyGroup被忽略?

Why does the icon specified in this anonymous PropertyGroup get obeyed, but the one in my conditional PropertyGroup get ignored?

我很欣赏这一个任何帮助。

I appreciate any help with this one.

推荐答案

据实际上大概的确实的工作。它只是你不能很容易地看到。 Windows资源管理器的图标存放在图标缓存的程序这真的尴尬的习惯。所以,如果你有一个图标运行.exe然后它存储在缓存中的图标。可用以后快速每当再次需要它。优化,挖一个图标出来.exe文件的速度很慢。

It probably actually does work. It is just something you can't easily see. Windows Explorer has this really awkward habit of storing icons for programs in the icon cache. So if you run an .exe with one icon then it stores the icon in the cache. To be available quickly later whenever it is needed again. An optimization, digging an icon out of an .exe file is slow.

重置缓存是可能的,但尴尬的是,最擅长superuser.com索要的一个良好程序。或者只是使用Visual Studio检查。文件+打开+文件,选择该.exe文件,打开图标节点,然后双击该条目。

Resetting the cache is possible but is awkward, best to ask at superuser.com for the a good procedure. Or just check it with Visual Studio. File + Open + File, select the .exe, open the Icons node and double-click the entry.

这篇关于设置不同的ApplicationIcon每个构建配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆