C# 在 Visual Studio 2010 中添加设置项目的快捷方式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11969085/
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
Adding shortcut to setup project in visual studio 2010
提问by Ali Behzadian Nejad
I am using visual studio 2010 and I have a .net desktop app (winform). I want to create a setup for project. I have added a setup wizard project to the solution. Now I want to add a shortcut to Programs menu and desktop. With right click on "User's Program menu" and selecting Add, I have only these options: Folder, File, Project output and Assembly. How can I add shortcuts? Another question: Is it possible to add .net 4.0 to setup project and install it if necessary? Thank you in advance.
我正在使用 Visual Studio 2010,并且有一个 .net 桌面应用程序 (winform)。我想为项目创建一个设置。我在解决方案中添加了一个安装向导项目。现在我想为程序菜单和桌面添加一个快捷方式。右键单击“用户的程序菜单”并选择添加,我只有以下选项:文件夹、文件、项目输出和程序集。如何添加快捷方式?另一个问题:是否可以在安装项目中添加 .net 4.0 并在必要时安装它?先感谢您。
回答by Hassan Boutougha
here the explanation to add a shortcut in your project: http://support.microsoft.com/kb/837220
这里是在您的项目中添加快捷方式的说明:http: //support.microsoft.com/kb/837220
回答by Praveen
Here is a good visualThis explains the entire setup and deployment in vs2010.
这是一个很好的视觉效果这解释了 vs2010 中的整个设置和部署。
A short note from my answer:
我的回答中的一个简短说明:
(1)File -> New Project -> Other Project Types -> Setup and Deployment -> Visual Studio Installer
(1)File -> New Project -> Other Project Types -> Setup and Deployment -> Visual Studio Installer
(2)Add a name to your setup project.
(2)为您的安装项目添加一个名称。
(3)Right click Application Folder -> Add -> project output
(3)右键应用程序文件夹->添加->项目输出
(4)****Select your respective project's solution "primary output from yours.."****
(4)****选择你各自项目的解决方案“primary output from yours..”****
(5)****Add the respective 3rd party dlls.**** // Never forget this one.
(5)****添加相应的第 3 方 dll。**** // 永远不要忘记这个。
(6)Right click setup project in solution explorer and BUILDit.
(6)右键单击解决方案资源管理器中的安装项目并构建它。
(7)Find the respective setup in debug folder(by default)
(7)在调试文件夹中找到相应的设置(默认)
You will get the .exeand .msiin the folder.
您将在文件夹中获得.exe和.msi。
回答by Adarsh Ravi
if you're looking to add shortcut to your desktop while installing your windows app you should follow these steps
如果您希望在安装 Windows 应用程序时向桌面添加快捷方式,则应按照以下步骤操作
- From Solution Explorer click your setup project.
- Click File System Editor (on top of Solution Explorer).
- When File System Editor has opened, on left tab you can see "File System on Target Machine". Click Application Folder.
- Then on the right tab the "Primary output from MyApp (Active)" appears. Right click it and select "Create shortcut to Primary output from MyApp (Active)". You should now see the shortcut appear below the primary output, which is your application executable.
- Drag & Drop that shortcut from right tab to left tabs File System on Target Machine - User's Desktop folder.
- Now the shortcut to your .exe will appear on the desktop after install.
- You can click the shortcut in File System Editor and edit the Name property from Properties grid to change the text that appears on the icon.
- 从解决方案资源管理器中单击您的安装项目。
- 单击文件系统编辑器(在解决方案资源管理器的顶部)。
- 打开文件系统编辑器后,在左侧选项卡上您可以看到“目标机器上的文件系统”。单击应用程序文件夹。
- 然后在右侧选项卡上出现“来自 MyApp(活动)的主要输出”。右键单击它并选择“从 MyApp(活动)创建主输出的快捷方式”。您现在应该看到快捷方式出现在主输出下方,这是您的应用程序可执行文件。
- 将该快捷方式从右侧选项卡拖放到左侧选项卡目标机器上的文件系统 - 用户的桌面文件夹。
- 现在 .exe 的快捷方式将在安装后出现在桌面上。
- 您可以单击文件系统编辑器中的快捷方式并从属性网格编辑名称属性以更改图标上显示的文本。
回答by AleX_
In order to include .net framework as part of the installation package, select your installer project from solution explorer, right click -> properties.
为了将 .net framework 作为安装包的一部分,从解决方案资源管理器中选择您的安装程序项目,右键单击 -> 属性。
In the opened window, press "prerequisites" button. Another window opens and select your desired .Net Framework version and then from the radio buttons choose "Download prerequisites from the same location as my application".
在打开的窗口中,按“先决条件”按钮。另一个窗口打开并选择所需的 .Net Framework 版本,然后从单选按钮中选择“从与我的应用程序相同的位置下载先决条件”。

