简体   繁体   English

C#Visual Studio使用错误的.exe图标

[英]C# Visual Studio using the wrong .exe icon

I first added "icon1.ico" to my project under Properties->Application. 我首先在“属性”->“应用程序”下将“ icon1.ico”添加到我的项目中。 When I build it my .exe had "icon1". 当我构建它时,我的.exe带有“ icon1”。 After this I decided to change the icon to "icon2.ico", which I added in the same way and selected. 之后,我决定将图标更改为“ icon2.ico”,以相同的方式添加并选择了该图标。 The little icon beside the dropdown menu shows "icon2". 下拉菜单旁边的小图标显示为“ icon2”。 However, when I build the project it still uses the old "icon1". 但是,当我构建项目时,它仍然使用旧的“ icon1”。

Then I removed the old icon from the project, and rebuilt. 然后,我从项目中删除了旧图标,然后进行了重建。 Still the same old icon. 仍然是相同的旧图标。 I then changed to the "default icon" in the dropdown (the dropdown only shows "icon2" and (default)) and rebuilt. 然后,我在下拉菜单中更改为“默认图标”(下拉菜单仅显示“ icon2”和(默认))并重新构建。 The exe then has the default icon. exe然后具有默认图标。 Changing back again to "icon2", and the exe has got "icon1", dispite it not being in the project anymore. 再次改回“ icon2”,exe有了“ icon1”,尽管它不在项目中了。

How can this be? 怎么会这样?

I managed to find what was wrong. 我设法找到问题所在。 In my Solution I had 3 projects. 在我的解决方案中,我有3个项目。 For some reason, dispite being seleted as the startup project, all my cleaning and rebuilding attempt seemed not to affect the project with the wrong icon (this includes deleting the bin folder), the only project that was being build was one of the other two (the output still said 3 build successfull, with 0 up to date). 出于某种原因,尽管被隔离为启动项目,但我所有的清理和重建尝试似乎都不会影响带有错误图标的项目(这包括删除bin文件夹),正在构建的唯一项目是另外两个项目之一(输出仍然表示3 build buildl,其中0是最新的)。

What solved it was to right click on the specific project and select rebuild, which applied the correct icon. 解决的方法是右键单击特定项目,然后选择“重建”,然后应用正确的图标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM