Article ID: 821766 - Last Review: November 26, 2007 - Revision: 1.6

How to build an installer by using Visual Basic .NET or Visual Basic 2005

On This Page

Expand all | Collapse all

SUMMARY

This step-by-step article describes how to create an installer for a Microsoft Visual Basic .NET or Microsoft Visual Basic 2005 Windows application . In this article, you create a solution that contains a simple Windows application that starts Windows Calculator. You then add a Setup Project to the solution to install the Windows application. Finally, you run the installer, and then install the Windows application.

Requirements

The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
  • Microsoft Windows 2000 Professional, Microsoft Windows 2000 Server, Microsoft Windows XP Professional, or Microsoft Windows Server 2003 with the Microsoft .NET Framework installed.
  • Microsoft Visual Studio .NET or Microsoft Visual Studio 2005 Enterprise Developer or Microsoft Visual Studio .NET or Microsoft Visual Studio 2005 Enterprise Architect.
This article assumes that you have a general familiarity with Windows applications. This article also assumes that the user account has the correct permissions to install applications.

Create a Setup Project for a Windows Application

This section demonstrates how to create a Windows application project and how to use a compiled Setup Project to install the Windows application.

Create a Windows Application

  1. Start Visual Studio .NET or Visual Studio 2005.
  2. On the File menu, point to New, and then click Project.
  3. In the New Project dialog box, click Visual Basic Projects under Project Type, and then click Windows Application under Templates. Name the project MyCalculator, and then click OK. By default, Form1 is created.

    Note In Visual Studio 2005, click Visual Basic under Project Type.
  4. Add a Button control to Form1.
  5. To add an event handler for the Button1 control, double-click Button1.
  6. In the event handler, add the following code:
     Shell("calc.exe", AppWinStyle.NormalFocus)
  7. To build the Windows application click Build MyCalculator on the Build menu.

Create a Setup Project

  1. On the File menu, point to Add Project, and then click New Project..
  2. In the Add New Project dialog box, click Setup and Deployment Projects under Project Type, and then click Setup Project under Templates.
  3. In the Name box, type MyCalculator Installer. The project is added to Solution Explorer, and the File System Editor appears.
  4. Click the MyCalculator Installer project in Solution Explorer.
  5. In Properties, click the ProductName property, and then type MyCalculator .

    Note The ProductName property determines the name that will be used for the application in folder names and in the Add/Remove Programs Control Panel.
  6. To build the project, click Build MyCalculator Installer on the Build menu.

Add a Windows Application to the Installer

  1. Click the MyCalculator Installer project in Solution Explorer. In the File System Editor, click the 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 MyCalculator in the Project list.
  4. Click the Primary Output group, and then click OK.
  5. On the Build menu, click MyCalculator Installer.

Verify That the Setup Project works

  1. In Solution Explorer, click the MyCalculator Installer project.
  2. To start the installer and to install the MyCalculator application, click Install on the Project menu.

REFERENCES

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
307358  (http://support.microsoft.com/kb/307358/ ) HOW TO: Create Shortcuts for a .NET Deployment Project

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
http://msdn2.microsoft.com/en-us/library/8z1sw3kx(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/8z1sw3kx(vs.71).aspx)
http://msdn2.microsoft.com/en-us/library/k3bb4tfd(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/k3bb4tfd(vs.71).aspx)


APPLIES TO
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Windows Installer 2.0
Keywords: 
kbvs2005swept kbvs2005applies kbdeployment kbhowtomaster kbsetupman kbdev kbprogramming KB821766
 

Article Translations