如何更改 Visual Studio 中控制台应用程序的图标?

发布于 2024-10-08 22:39:10 字数 382 浏览 3 评论 0原文

我正在 VS 2008 中开发 C# 控制台应用程序,无法更改图标文件。

我在 project-->properties-->application 选项卡中更改了图标文件,但旧图标仍然与新版本一起显示。

检查了帖子中的以下答案以修改 .resx 文件。但我的应用程序只有一个 .cs 文件,而 .resx 文件 为空。

Visual Studio,更改应用程序图标,如何?

I am working on C# Console App in VS 2008 and am unable to change the icon file.

I changed the icon file in project-->properties-->application tab but still the old icon is displaying with the new build.

Checked the below answer from a post to modify the .resx file. But my app has got only one .cs file and the .resx file is empty.

Visual Studio, change app icon, how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

堇年纸鸢 2024-10-15 22:39:10

当您更改图标时,项目的“属性”窗口是否看起来像这样?

   在项目属性中设置控制台应用程序的图标

确保重新编译(您可能需要清理您的首先解决方案,然后重建),然后您在正确的文件夹中搜索新构建的可执行文件。如果您在调试模式下进行编译,则默认文件夹为(从项目文件夹的根级别开始):\bin\Debug。如果您在发布模式下编译,它将位于 \bin\Release 中。

按照上述步骤,这对我来说效果很好。我新创建的“ConsoleApplication1”获得了一个漂亮的绿皮书图标:

   

>确保您正在查看正确的文件!只有您的可执行文件 (.EXE) 才会接受自定义图标处理。名称中包含“vshost”的文件由 Visual Studio 使用,其他文件包含调试信息等。此外,.DLL 文件无法显示自定义图标 - Windows 对所有 DLL 使用相同的图标,通常看起来像这样一张纸上的两个齿轮。

如果您仍然没有任何运气,您可以用有关您正在做的事情的更多详细信息来更新您的问题吗?否则我无法重现您遇到的问题。

When you change the icon, does your project's Properties window look something like this?

   setting icon for console app in project properties

Make sure that you recompile (you might need to clean your solution first and then rebuild), and then that you're searching in the correct folder for your newly-built executable. If you're compiling in Debug mode, the default folder is (starting from the root level of your project's folder): \bin\Debug. If you're compiling in Release mode, it will be in \bin\Release.

Following the above steps, this works fine for me. My newly-created "ConsoleApplication1" gets a beautiful green book icon:

   Console application with custom icon

Make sure that you're looking at the right file! Only your executable (.EXE) is going to receive the custom icon treatment. The file that contains "vshost" in its name is used by Visual Studio, and the other files contain debug information, etc. Additionally, .DLL files cannot show custom icons—Windows uses the same icon for all DLLs and it usually looks something like two gears on a piece of paper.

If you still aren't having any luck, can you update your question with more details about what you're doing, specifically? I can't reproduce the problems you're experiencing otherwise.

鲜肉鲜肉永远不皱 2024-10-15 22:39:10

我有同样的问题。
尝试删除 C:\Users\\AppData\Local\IconCache.db 后
新图标按预期显示。

您可以按照以下步骤尝试:https://superuser.com/a/499083

I have the same problem.
After trying to delete C:\Users\\AppData\Local\IconCache.db
the new icon is shown as expected.

You can try it follow steps at: https://superuser.com/a/499083

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文