在VS2010安装项目中设置正确的快捷方式图标

发布于 2024-12-29 05:06:49 字数 158 浏览 6 评论 0原文

我有一个带有安装项目的小应用程序。 如果我创建主输出的快捷方式,那么这会得到一个标准的 Win7 图标,而不是我的 exe 的应用程序图标中指定的图标?

确保我的桌面快捷方式图标与我的 exe 图标相同的最佳方法是什么? 例如,如果我更改 exe 的图标,那么我希望安装程序图标也更改。

I have a small app with a setup project.
If I create a shortcut to my Primary Output, then this gets a standard Win7 icon and not the icon specified in my exe's Application Icon?

Whats the best way to make sure my desktop shortcut icon is the same icon as my exe?
e.g. If I change the exe's icon then I'd like the Setup icon to change as well.

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

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

发布评论

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

评论(4

你的他你的她 2025-01-05 05:06:49

如果您设置快捷方式的图标,则可以将主输出设置为源。在安装项目的文件系统编辑器中,单击快捷方式属性窗格中的“(图标)”组合框,然后单击选项“(浏览...)”,按钮“浏览...”。您将看到:

Add Output

然后添加输出并选择 exe 的主要输出。

If you set the icon for the shortcut you can set a primary output as source. In the file system editor of the setup project, click on the "(Icon)" combobox in the properties pane of the shortcut, then option "(Browse...)", button "Browse...". You'll see this:

Add Output

Then add output and select the primary output of the exe.

温柔戏命师 2025-01-05 05:06:49

您可以将 target.exe 文件中的图标添加到快捷方式...在目标计算机上的文件系统中,浏览到要添加图标的文件夹(用户桌面等)中的快捷方式。右键单击该快捷方式并选择“属性窗口”。您将看到一个图标行...单击它,选择浏览,然后浏览到应用程序文件夹/yourExe.exe(从 ICON 更改为 Exe 文件)并单击“确定”。它将显示您选择的来自 yourExe.exe 的图标,选择“确定”。您基本上必须对安装项目的“添加/删除图标”(显示在“控制面板/卸载”中)...属性页执行相同的操作。您必须对不同文件夹(用户的桌面、用户的启动等)中的所有快捷方式执行此操作。所有图标现在都很好!

You can add an icon from your target.exe file to the shortcut... in File System On Target Machine, browse to the shortcut in the folder you want to add the icon to (User's Desktop,etc). Right click the shortcut and select Properties Window. You'll see an Icon line... click it, select Browse, then browse to Application Folder/yourExe.exe (change from ICON to Exe files) and say OK. It will show you the icon from yourExe.exe that it has selected, say OK. You basically have to do the same thing for your Add/Remove Icon (appears in Control Panel/Uninstall)... properties page for your setup project. You have to do it for all shortcuts in different folders (User's Desktop, User's Startup, etc.) All icons good now!

云胡 2025-01-05 05:06:49

要添加到 Gert 的答案中:请确保首先构建您的项目。否则安装应用程序将看不到该图标。

To add to Gert's answer: make sure you build your project first. Otherwise the setup app will not see the icon.

默嘫て 2025-01-05 05:06:49

使用 IWshShortcut 的非常简单的方法(也适用于 .net 2):

WshRuntimeLibrary.IWshShortcut MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(fullPathLnk);    
string iconLoc = MyShortcut.IconLocation; // <- example: "c:\icon.ico,0"

我用来检查 iconLoc 是否仍然存在,如果不存在则修复,您可以用来查找和读取图标文件等

Very simple way using IWshShortcut (works in .net 2 too):

WshRuntimeLibrary.IWshShortcut MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(fullPathLnk);    
string iconLoc = MyShortcut.IconLocation; // <- example: "c:\icon.ico,0"

I use to check if iconLoc still exists, fix if not, you can use to find and read icon file, etc etc

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