vb.net 如何更改 Visual Basic 程序 (.exe) 的桌面图标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18983614/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 15:13:11  来源:igfitidea点击:

how do i chnage the desktop icon for a visual basic program (.exe)

vb.netvisual-studio-2012icons

提问by Math chiller

im making a vb.net app and i want to set the icon, how can i do this?

我正在制作一个 vb.net 应用程序,我想设置图标,我该怎么做?

--edit--

- 编辑 -

turns out i was a bit confused, and it was working. but the answers can still be useful for others.

原来我有点困惑,它正在工作。但答案对其他人仍然有用。

回答by tinstaafl

'The folder shows the icon for the app, but the icon for the form is different. change the form's icon(in the property grid) to the same as the app and you should see it then.

'文件夹显示了应用程序的图标,但表单的图标不同。将表单的图标(在属性网格中)更改为与应用程序相同的图标,然后您应该会看到它。

When you publish it there's 2 files produced that are basically setup files. One relies on the ClickOnce Application Deployment Support Library and the other is a standalone setup app. Since neither one is the actual app you designed, they aren't going to have the icon you want. You'll probably have to investigate other more configurable deployment options.

当您发布它时,会生成 2 个文件,它们基本上是安装文件。一个依赖于 ClickOnce 应用程序部署支持库,另一个是独立的设置应用程序。由于两者都不是您设计的实际应用程序,因此它们不会有您想要的图标。您可能需要研究其他更可配置的部署选项。

回答by ??ssa P?ngj?rdenlarp

If I understand the question and issue, your setup/installer might be missing something.

如果我理解问题和问题,您的设置/安装程序可能会丢失一些东西。

  1. It would seem you did create a shortcut, add it to the Setup project to install to the Desktop (else you wouldnt have one at all)

  2. Select the shortcut in your setup project, open the properties window

  3. Click Target. The list of files you are installing will come up. Select the App.Exe (ie the main executable "MyApp.exe" ususally the primary output). I think Iconis supposed to be set to "Icon" as well.

  1. 看起来你确实创建了一个快捷方式,将它添加到安装项目中以安装到桌面(否则你根本就没有)

  2. 选择安装项目中的快捷方式,打开属性窗口

  3. 单击Target。将出现您正在安装的文件列表。选择 App.Exe(即主要的可执行文件“MyApp.exe”通常是主要输出)。我认为Icon也应该设置为“图标”。

I think those 2 things combined link the Desktop Shortcut's Icon property to Use the App.Exe's. If there is also a shortcut in the user's programs menu do the same thing (or drag drop a copy).

我认为这两件事结合起来将桌面快捷方式的图标属性链接到使用 App.Exe 的属性。如果用户的程序菜单中也有快捷方式,请执行相同的操作(或拖放副本)。

You are basically doing to the Setup Project's shortcut what you would do to a normal desktop icon to change it or set it. The proj apparently fills in the actual path etc at install.

您基本上是在对安装项目的快捷方式进行操作,就像对普通桌面图标进行更改或设置一样。该项目显然在安装时填写了实际路径等。

EDIT

编辑

PUBLISH simply compiles everything and produces files for the dev to distribute. It is called PUBLISH because in many cases the output includes a ready to use Setup program for the END USER to install on the PC. (Based on your new Pic, you are trying to reinstall everytime you click the icon or file inside the folder.)

PUBLISH 简单地编译所有内容并生成供开发人员分发的文件。之所以称为 PUBLISH,是因为在许多情况下,输出包括可供最终用户安装在 PC 上的准备使用的安装程序。(根据您的新图片,每次单击文件夹内的图标或文件时,您都在尝试重新安装。)

Again, if you do not add a Setup proj to your project, the default one is used and it gives no option for where to install and does not add a shortcut.

同样,如果您没有将安装程序添加到您的项目中,则会使用默认的程序,它没有提供安装位置的选项,也不会添加快捷方式。

Just delete all that junk, Publish again to the default location (VS Studio\...Project name\bin\Publish). Go to that folder and run setup. It will still install to Users\AppData..but will add a shortcut (to the program) to the start menu.

只需删除所有垃圾,再次发布到默认位置 ( VS Studio\...Project name\bin\Publish)。转到该文件夹​​并运行安装程序。它仍然会安装到Users\AppData..开始菜单,但会添加一个快捷方式(到程序)。

For a desktop icon, do the "Send To Desktop ..." thing. To INSTALL an icon, you have to add and modify a Setup proj to your Solution.

对于桌面图标,请执行“发送到桌面...”操作。要安装图标,您必须向解决方案添加和修改安装项目。

HTH

HTH