Microsoft KB Archive/821766

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

Article ID: 821766

Article Last Modified on 11/26/2007

-

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

-



IN THIS TASK
SUMMARY Requirements Create a Setup Project for a Windows Application
 * Create a Windows Application
 * Create a Setup Project
 * Add a Windows Application to the Installer

Verify That the Setup Project Works REFERENCES



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.

back to the top

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.

back to the top

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
 Start Visual Studio .NET or Visual Studio 2005. On the File menu, point to New, and then click Project. 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. Add a Button control to Form1. To add an event handler for the Button1 control, double-click Button1.  In the event handler, add the following code: Shell(&quot;calc.exe&quot;, AppWinStyle.NormalFocus)  To build the Windows application click Build MyCalculator on the Build menu.</li></ol>

back to the top

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.
 * 1) To build the project, click Build MyCalculator Installer on the Build menu.

back to the top

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.

back to the top

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.

back to the top

<div class="references_section">