ASP.NET 2.0 Options for Packaging and Deploying Web Apps, Page 3
Deployment Using the Visual Studio 2005 Web Setup Project
This section shows how to use the Visual Studio 2005 Web Setup Project to deploy your Deployment Web site.
Creating a Web setup project using Visual Studio 2005 Installer
Start by adding a new Web Setup Project to your Deployment Web site by selecting File->Add Project-> New Project from the menu. In the New Project dialog box, select Setup and Deployment from the Project Types pane, and then select Web Setup Project in the Templates pane (as shown in Figure 8).
Click here for a larger image.
Figure 8. Select Web Setup Project in the Templates Pane
Once you've created the project, the first step is to add the output of the primary assembly and the content files of the Deployment Web site to the setup project. To do this, right-click on the DeploymentSetup project in the solution explorer and select Add->Project Output from the context menu. In the Add Project Output Group dialog box, select Deployment from the Project combo box and select Content Files from the list.
Configuring properties through the properties window
Visual Studio 2005 allows you to configure most of the important properties associated with deployment by using the Properties dialog of the Web Setup Project. These properties determine the runtime display and behavior of the Windows installer file. To utilize this function, right-click on the DeploymentSetup project from the solution explorer and select Properties from the context menu to open its properties window. The dialog box shown in Figure 9 appears on the screen.
Figure 9. Select Web Setup Project in the Templates Pane
By using the above screenshot, you can configure properties such as Author, Description, Manufacturer, SupportPhone, and so on. Once you set these properties, they will then be available to the users of the Windows installer at the installation time.
Installing the ASP.NET Web application
Now that you have configured all the properties, build the DeploymentSetup project by right-clicking on the DeploymentSetup project from the solution explorer and selecting Build from the context menu. This will create a DeploymentSetup.msi file that you can use to install the Web application on the target servers. You can kick off the installation by double-clicking on the .msi file from Windows exporer. This will initiate the setup wizard that will walk you through the installation steps. The first step in the installation will look like Figure 10.
Figure 10. The First Step in the Installation of the Web Application on Target Servers
Clicking on Next in the above dialog box results in the dialog box in Figure 11, where you can specify the virtual directory that you will use to host the Web application. Note that in the previous versions of Visual Studio Installer, you had no way to specify the target Web site under which the virtual directory would be created. However, as you can see in Figure 11, Visual Studio 2005 provides you with an option to specify the root Web site that will host the virtual directory. By using the Site dropdown box, you can select the Web site where you want to install the virtual directory.
Figure 11. Option to Specify the Root Web Site That Will Host the Virtual Directory
In the above dialog box, you also can click on the Disk Cost... command button to get an idea of the space required for installing this Web application. Clicking on Next in the above dialog box results in the dialog box shown in Figure 12, which asks you to confirm the installation.
Figure 12. The Dialog Box Asking You to Confirm the Installation
When you click on Next in the above dialog box, the installation will begin and the application will be installed. If the application is successfully installed, you will see the dialog box shown in Figure 13.
Figure 13. The Dialog Box Asking You to Confirm the Installation
Now that the installation is complete, you can see the installed ASP.NET application through the Add/Remove Programs option (that you can access through Start->Settings->Control Panel) on your computer.
What Have You Learned?
This article demonstrated the different ways of packaging and deploying an ASP.NET 2.0 Web application. You also learned how to take advantage of Windows installer technology to create .msi Windows installer files.
Download the Code
To download the accompanying source code for the demo, click here.
About the Author
Thiru Thangarathinam has six years of experience in architecting, designing, developing, and implementing applications using object-oriented application development methodologies. He also possesses a thorough understanding of the software life cycle (design, development, and testing). He holds several certifications, including MCAD for .NET, MCSD, and MCP. Thiru is an expert with ASP.NET, .NET Framework, Visual C# .NET, Visual Basic .NET, ADO.NET, XML Web services, and .NET Remoting. Thiru also has authored numerous books and articles. Contact him at firstname.lastname@example.org.
Page 3 of 3