How to add a shortcut file to a Setup project in Visual Studio 2005 or in Visual Studio .NET (837220)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition

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.
  4. Under Templates, click Windows Application.
  5. 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:
  1. In the project folder of the Windows Application project that you created in the "Create a Windows Application project" 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

  2. In Solution Explorer, click MyWindowsApp, and then click Refresh.
  3. On the Project menu, click Show All Files.
  4. In Solution Explorer, right-click the shortcut file that you created in step 1, and then click Include In Project.
  5. In Solution Explorer, right-click the shortcut file, and then click Properties.
  6. Set the Build Action property to Content.
  7. On the Build menu, click Build MyWindowsApp to build the Windows Application project.
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:
  1. In Visual Studio 2005 or in Visual Studio .NET, create a Setup project:
    1. In Solution Explorer, right-click MyWindowsApp, point to Add, and then click New Project. The Add New Project dialog box appears.
    2. Under Project Type, click Setup and Deployment Projects.

      Note In Visual Studio 2005, click Other Project Types, and then click Setup and Deployment.
    3. Under Templates, click Setup Project.
    4. In the Name box, type MyWindowsAppInstaller, and then click OK. The project is added to Solution Explorer, and the File System Editor appears.
  2. Add the project output of the Windows Application project to the Setup project:
    1. In the File System Editor, click Application Folder.
    2. On the Action menu, point to Add, and then click Project Output.
    3. In the Add Project Output Group dialog box, click Primary output, and then click OK.
    4. In the File System Editor, click User's Desktop.
    5. On the Action menu, point to Add, and then click Project Output.
    6. In the Add Project Output Group dialog box, click Content Files, and then click OK.
  3. On the Build menu, click Build MyWindowsAppInstaller.
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

REFERENCES

For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

821766 How to: Build an installer by using Visual Basic .NET

307358 HOW TO: Create shortcuts for a .NET deployment project

back to the top

Modification Type:MajorLast Reviewed:2/2/2006
Keywords:kbvs2005swept kbvs2005applies kbsetup kbDeployment kbHOWTOmaster KB837220 kbAudDeveloper