Visual Studio 安装程序项目:安装程序和应用程序图标
我的一个应用程序有一个图标,我已将其嵌入到资源文件中,并用作该应用程序的主图标。到目前为止,一切都很好。
但是,我想对安装程序项目以及安装程序在“开始”菜单中放置的快捷方式使用相同的图标。我可以为安装程序包本身设置图标,但前提是我将图标作为 .ico 文件添加到主应用程序文件夹中。
将图标嵌入到资源文件中的全部目的是这样我就不会在 Program Files 中出现 ICO 文件。我无法从安装程序项目中的主项目访问资源文件 - 我是否缺少一些技巧?
其次,即使我在主文件夹中包含一个图标,如果我设置菜单快捷方式来使用它,它也不会 - 它会在安装程序后在 IDE 和菜单中显示标准快捷方式图标。再说一次,我在这里错过了一个技巧吗?
I've got an icon for one of my applications, which I've embedded in a resource file and is used as the main icon for the application. So far so good.
However, I want to use the same icon for the installer project, and for the shortcut that the installer places in the Start Menu. I can set the icon for the installer package itself, but only if I add the icon as an .ico file in the main application folder.
The whole point of embedded the icon in a resource file is so that I don't have an ICO file floating around in Program Files. I can't access the resource file from the main project in the installer project - is there some trick that I am missing?
Secondly, even if I include an icon in the main folder, if I set the menu short cut to use it, it doesn't - it shows the standard shortcut icon both in the IDE and in the menu after the program has been installed. Again, am I missing a trick here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我现在没有时间测试它,但是当您浏览图标时,您将看到一个对话框,让您选择目标计算机上的项目。对话框底部是一个下拉列表,可让您选择文件类型。如果您选择 EXE(或可能是 DLL),则会显示您的主要项目输出。选择后,您可以选择项目输出包含的任何嵌入图标。
(我没有测试的是:在测试计算机上安装软件后图标是否实际显示。)
I have no time to test it now, but when you browse for an icon you will be presented with a dialog that lets you choose items that will be on the target computer. At the bottom of the dialog is a dropdown that lets you select the file type. If you choose EXE (or possibly DLL), then you primary project output(s) will show. Once you select that you can chose any embedded icon that your project output contains.
(What I did not test: If the icons actually show after you installed your software on a test computer.)
图标的大小应在 10 kb - 40 kb 之间。不然不会显示出来。
谢谢,
安舒尔
The size of your icon should be between 10 kb - 40 kb. Otherwise it wont show up.
Thanks,
Anshul
上述解决方案对我来说不起作用,包括商业网络转换器。
最后,我在 关于创建 ICO 文件的 MS 文档:
这似乎是相关的,因为当我将 ICO 中的所有 3 个图像(16x16、32x32、64x64)设置为 24b 深度时,生成的 37 KB 文件起作用并且图标开始显示在桌面上。未使用压缩。而且我是在 GIMP 中完成的,所以这不是 GIMP 的问题,而是设置的问题。
它适用于“添加文件”对话框中输出的 EXE 和 ICO 类型(因此来自已安装项目输出和安装程序项目输出)。
No solution described above worked for me, including the commercial web convertor.
Finally, I read this in the MS documentation about createing ICO files:
It seems to be related, because when I set all 3 images within ICO (16x16, 32x32, 64x64) to 24b depth, the resulting 37 KB file worked and icon started to show on the desktop. No compression used. And I did it in GIMP, so it's not a GIMP issue, but the settings.
And it works with both EXE and ICO type (so both from installed project output and the installer project output) of output in the "Add file" dialog.