|
| |
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
- Automatically creates virtual directories and
configures required IIS settings.
- If the installation fails everything will be rolled
back and the system will return to the state before installation
began.
- Reinstallation process is easier when any of the
installed files get corrupted or deleted
- 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. - On the File menu, click Add Project, and
then choose New Project.
- 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
- 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.
- 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
- 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.
 - 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.
- 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.
- 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.
- 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.
- 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 Force is optimised for
Microsoft Internet Explorer 5 browsers.
Copyright © 2004 .NET Force.
Terms and Condition. All rights reserved.
|
 |
|