Microsoft KB Archive/837220

= How to add a shortcut file to a Setup project in Visual Studio 2005 or in Visual Studio .NET =

Article ID: 837220

Article Last Modified on 2/2/2006

-

APPLIES TO


 * Microsoft Visual Studio 2005 Standard Edition
 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-





IN THIS TASK

 * INTRODUCTION
 * Requirements
 * Create a Windows Application project
 * Add a shortcut file to your Windows Application project
 * Add a Setup project to your Windows Application project
 * Verify that the shortcut is created on the desktop
 * REFERENCES



INTRODUCTION
This step-by-step article describes how to add a shortcut (.lnk) file to a Setup project in Microsoft Visual Studio 2005 or in Microsoft Visual Studio .NET. To do this, you have to add the shortcut file to your Microsoft Windows Application project and then set the Build Action property to Content. Then, in your Setup project, add the content files from your Windows Application project to the User's Desktop folder.

back to the top

Requirements
The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
 * Microsoft Windows 2000, Microsoft Windows XP, or Microsoft Windows Server 2003
 * Microsoft Visual Studio .NET

back to the top

Create a Windows Application project
To create a Windows Application project, follow these steps:
 * 1) Start Visual Studio 2005 or Visual Studio .NET.
 * 2) On the File menu, point to New, and then click Project. The New Project dialog box appears.
 * 3) Under Project Type, click Visual Basic Projects.

Note In Visual Studio 2005, Visual Basic Projects is changed to Visual Basic.
 * 1) Under Templates, click Windows Application.
 * 2) In the Name box, type MyWindowsApp, and then click OK. By default, a Windows Form that is named Form1 is created.

back to the top

Add a shortcut file to your Windows Application project
To add a shortcut file to your Windows Application project, follow these steps:  In the project folder of the Windows Application project that you created in the &quot;Create a Windows Application project&quot; section, create a shortcut. For additional information about how to create a shortcut, click the following article number to view the article in the Microsoft Knowledge Base:

140443 How to create a shortcut on the desktop

 In Solution Explorer, click MyWindowsApp, and then click Refresh. On the Project menu, click Show All Files. In Solution Explorer, right-click the shortcut file that you created in step 1, and then click Include In Project. In Solution Explorer, right-click the shortcut file, and then click Properties. Set the Build Action property to Content. On the Build menu, click Build MyWindowsApp to build the Windows Application project.</li></ol>

back to the top

Add a Setup project to your Windows Application project
To add a Setup project to your Windows Application project, follow these steps: <ol> In Visual Studio 2005 or in Visual Studio .NET, create a Setup project: <ol style="list-style-type: lower-alpha;"> In Solution Explorer, right-click MyWindowsApp, point to Add, and then click New Project. The Add New Project dialog box appears.</li> Under Project Type, click Setup and Deployment Projects.

Note In Visual Studio 2005, click Other Project Types, and then click Setup and Deployment.</li> Under Templates, click Setup Project.</li> In the Name box, type MyWindowsAppInstaller, and then click OK. The project is added to Solution Explorer, and the File System Editor appears.</li></ol> </li> Add the project output of the Windows Application project to the Setup project: <ol style="list-style-type: lower-alpha;"> In the File System Editor, click Application Folder.</li> On the Action menu, point to Add, and then click Project Output.</li> In the Add Project Output Group dialog box, click Primary output, and then click OK.</li> In the File System Editor, click User's Desktop.</li> On the Action menu, point to Add, and then click Project Output.</li> In the Add Project Output Group dialog box, click Content Files, and then click OK.</li></ol> </li> On the Build menu, click Build MyWindowsAppInstaller.</li></ol>

back to the top

Verify that the shortcut is created on the desktop

 * 1) In Solution Explorer, right-click MyWindowsAppInstaller, and then click Install.
 * 2) Follow the instructions in the Setup wizard. After the Setup wizard has completed, notice that the shortcut appears on your desktop.

back to the top

<div class="references_section">