Thursday, September 02, 2010
Search:
Article
48Hrs Help PAQ's
FAQ's
Download
Books
MS Alerts
Write to Us
Feedback
Link




a) What are .NET My Services?
b) Why use .NET My Services?

Get This Blog via Email:


Email This Feed Using Squeet




Creating Setup Project For Web Application Using VS.Net


By Sriram V
May 27, 2004
Page is Viewed 32713 times


  
ASp.NET Setup


The VisualStudio.Net environment provides us with the facility of creating windows installer (.MSI) files for deploying our web applications. This installer gives us more control over the installation process. This article explains the process of creating a web setup project using Visual Studio .Net and deploying it.

One of the advantages of ASP.Net is the ability to deploy an application using DOS XCopy command. Even though the XCopy command is very simple to use, creating a windows installer file is preferred because it has the following advantages

  1. Automatically creates virtual directories and configures required IIS settings.
  2. If the installation fails everything will be rolled back and the system will return to the state before installation began.
  3. Reinstallation process is easier when any of the installed files get corrupted or deleted
  4. The installed application can be easily uninstalled completely.

Now we will see how to create a simple Web application using C# and create installer for deploying the application.

The fist step is to create the web application with as many web forms, images, html files etc as we want. For example we create a web application named MyWebApp. The next step is to create the web setup project for our web application. Following is the sequence of actions that has to be performed for creating the Web setup project and deploying it on the development computer or on other computers.

  1. On the File menu, click Add Project, and then choose New Project.
  2. In the AddNew Project dialog window that opens, select Setup and Deployment Projects in the Project Types pane, and then choose Web Setup Project in the Templates pane. In the Name text box, type the name of the setup project for example MyWebSetup and click Ok. This is shown in figure below



  1. MyWebSetup project will be added to the solution and File System Editor Window appears. By default a folder by name Web Application Folder will appear on the left pane.
  2. Right click on the Web Application Folder, select Add and then from the sub menu that appears select Project Output. This will open the Add Project Output Group dialog window as shown in figure below



  1. Select the Primary Output and Content Files groups from the list, and then click OK. The Content Files option will add all the aspx, html, xml and other content files to the web application folder. This will also add all subfolders and content files under them. The Primary Output files option will add the necessary assemblies to the bin folder. We can see the files added by right clicking the Content Files or Primary Output files in the right pane and selecting the Outputs menu. This is shown in figure below.



  1. VS.Net will automatically detect all the dependencies and them to the project. You can see the list of dependencies detected under the Detected Dependencies folder in solution explorer. For our project a single dependency file by the name of dotnetfxredist_x86_enu.msmwill be added. This is a merge module which contains .Net framework re-distributable. This file will be excluded by default since we assume that the machine we are going to deploy contains .Net Frame work. If that’s not the case then we need to include this file.
  2. To configure various IIS settings right click on Web Application Folder in the right pane and select Properties Window. In the properties dialog window that appears various settings like virtual directory name, default document, directory browsing etc can be set.
  3. After completion of above steps we can go ahead and build the MyWebSetup project. With a successful build, three files namely MyWebSetup.msi, Setup.Exe, Setup.ini can be found in the Debug or Release folder of the MyWebSetup project depending on the build settings. Executing Setup.exe will open the Setup wizard which will guide you in installing MyWebApp web application on the development computer.
  4. For deploying the application on a different computer other than the development computer copy all the three files to the target computer and execute Setup.exe.
  5. We can also deploy the application in our development computer by selecting Install option under the Project menu. There is also an Uninstall option available under the project menu for uninstalling the application from development computer.

This article explained the various steps and configurations involved in creating a setup project for web application using Visual studio.Net. Also we saw how to deploy the application in development and non development computers. Do ping me at sriram@dotnetforce.com for further discussion on this or incase you have any doubts.



.NET:
The .NET Framework is a new computing platform that simplifies application development in the highly distributed environment of the Internet.
ASP.NET:
A set of technologies in the Microsoft .NET Framework for building Web applications and XML Web services. ASP.NET pages execute on the server and generate markup (such as HTML, WML, or XML) that is sent to a desktop or mobile browser. ASP.NET pages use a compiled, event-driven programming model that improves performance and enables the separation of application logic and user interface. ASP.NET pages and XML Web services files created using ASP.NET contain server-side (rather than client-side) logic written in Visual Basic .NET, C# .NET, or any .NET-compatible language. Web applications and XML Web services take advantage of the features of the common language runtime, such as type safety, inheritance, language interoperability, versioning, and integrated security.
C#:
A new programming language designed for building enterprise applications that run on the .NET Framework. C#, which is an evolution of C and C++, is type safe and object oriented. Because it is compiled as managed code, it benefits from the services of the common language runtime, such as language interoperability, security, and garbage collection.
Class:
A reference type that encapsulates data (constants and fields) and behavior (methods, properties, indexers, events, operators, instance constructors, static constructors, and destructors), and can contain nested types. Class types support inheritance, a mechanism whereby a derived class can extend and specialize a base class. See also: encapsulation, indexer, property, reference type.
.NET Framework:
An integral Windows component that supports building and running the next generation of applications and XML Web services. It provides a highly productive, standards-based, multilanguage environment for integrating existing investments with next generation applications and services, as well as the agility to solve the challenges of deployment and operation of Internet-scale applications. The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of ASP called ASP.NET. See also: ASP.NET, common language runtime, .NET Framework class library.
.NET Force is optimised for Microsoft Internet Explorer 5 browsers.
Copyright © 2004 .NET Force.
Terms and Condition. All rights reserved.