Click here to Skip to main content
13,149,756 members (66,499 online)
Click here to Skip to main content
Add your own
alternative version

Stats

364.9K views
101 bookmarked
Posted 31 Aug 2002

Deploying Web Applications using Visual Studio .NET

, 31 Aug 2002
Rate this:
Please Sign up or sign in to vote.
Deploying an ASP.NET project using the Visual Studio .NET Windows Installer

Introduction

Deployment is a great feature in Visual Studio .NET which allows you to deploy your applications by creating a Setup Program. You can make a setup project for both your Windows and Web applications.

Using this feature for deploying has many advantages for example:

  • Installed applications can be uninstalled completely.
  • If an error occurred through installation process, the system goes back to the state of before the installation.
  • Adding user interface to setup project easily.
  • Making setup project on different kinds of distribution media such as CD or floppy disks.
  • Easy reinstallation when installed files get corrupted.

In this article, I will create a simple ASP.NET Web project and then create a setup project for deploying that.

First of all create an ASP.NET Web project using Visual Studio .NET and name it for example "TestWeb". In the WebForm designer (WebForm1.aspx). Drag and drop a Label and a button server control. Double click on button and then add the following code and compile the project.

private void Button1_Click(object sender, System.EventArgs e)
{
    Label1.Text = "My first deployment web project";
}  

Creating the Web Setup project

After creating the web project or opening an existing web project, You can use VS.NET installer to create a Web Setup project. So do the following steps.

Add a Web Setup project to the solution through File/New/Project menu. Choose the Setup and Deployment Projects in Project Types tree control and after that select the Web Setup Project from Templates list box and name it WebSetup. Be aware of select the Add to Solution radio button.

Now the project is added to the Solution Explorer, and you can see the File System Editor. With File System Editor, you can add files and dependencies to the setup project and configure the location of installation.

Now you must add project files and dependencies to the setup project. For this reason right click on the Web Application Folder in File System Editor and choose Add/Project Output from the menu (You can do this through Action menu as well). Then select the Primary Output and Content Files from the Add Project Output Group dialog.

By pressing the OK button the primary output and content files of the TestWeb project will be added to the Application Folder automatically. Also the dependencies are automatically detected in the Solution Explorer. As you can see the dotnetfxredist_x86_enu.msm merge module is added to the WebSetup project. This merge module includes all assemblies of .NET framework. The exclude property of dotnetfxredist_x86_enu.msm is TRUE by default. In our case we suppose that .NET runtime is already installed on the target machine, otherwise you can define .NET Framework Lauch Condition in your setup project.

In the properties window, set the DefaultDocument property to "Webform1.aspx" page.

It's now time to build your web setup. So right click on WebSetup on Solution Explorer and choose Build. With a successful build, you can find the following files in the Debug or Release directory (depending on your build settings).

By executing Setup.exe the TestWeb project will be installed on the target system. Since we excluded .NET framework from our setup project, we must install the TestWeb application on the system with .NET framework installed. After installation process you can see TestWeb in IIS directory.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Majid Shahabfar
Software Developer (Senior)
Iran (Islamic Republic of) Iran (Islamic Republic of)
Majid is a well-experienced .NET developer who directs his own community PersiaDevelopers.com which is a Microsoft software development technology community for Persian native developers.
He is involved in many kind of software projects and also doing some tasks on High Performance Computing including massive parallel computing and GPU programming.
He is working as a software designer and developer and also as a consultant for some IT related companies.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
GeneralRe: Content Files Pin
daniero8-Nov-05 5:46
memberdaniero8-Nov-05 5:46 
GeneralWeb Setup in Windows 2003 IIS 6.0 Pin
pepe_el_ornitorrinco13-Sep-05 9:06
susspepe_el_ornitorrinco13-Sep-05 9:06 
GeneralDeploying Web Applications Pin
Aghatti9-Jul-05 4:36
memberAghatti9-Jul-05 4:36 
GeneralS.O.S (DATAGRID) Pin
mcansin16-Mar-05 3:01
membermcansin16-Mar-05 3:01 
GeneralCreating multiple virtual directories !! Pin
Johnson Thomas C6-Oct-04 20:53
memberJohnson Thomas C6-Oct-04 20:53 
GeneralRe: Creating multiple virtual directories !! Pin
ChainsawDon4-Feb-05 10:55
memberChainsawDon4-Feb-05 10:55 
GeneralDeploy Web App manually Pin
Aubyone15-Aug-04 21:05
memberAubyone15-Aug-04 21:05 
GeneralRe: Deploy Web App manually Pin
daniero8-Nov-05 5:54
memberdaniero8-Nov-05 5:54 
GeneralINtegrating interface with aspx Pin
Ashwin Murali5-Jul-04 7:21
sussAshwin Murali5-Jul-04 7:21 
GeneralDeploying webapp on server w multiple sites Pin
flab00722-Jun-04 10:52
memberflab00722-Jun-04 10:52 
GeneralRe: Deploying webapp on server w multiple sites Pin
flab00724-Jun-04 0:51
memberflab00724-Jun-04 0:51 
GeneralRe: Deploying webapp on server w multiple sites Pin
ChainsawDon4-Feb-05 10:53
memberChainsawDon4-Feb-05 10:53 
GeneralWindows 2003 & IIS 6.0 Pin
Francois Laperriere28-Apr-04 13:42
sussFrancois Laperriere28-Apr-04 13:42 
GeneralRe: Windows 2003 & IIS 6.0 Pin
Francois Laperriere28-Apr-04 15:30
sussFrancois Laperriere28-Apr-04 15:30 
Generaladding user groups Pin
sanpsan31-Mar-04 19:47
susssanpsan31-Mar-04 19:47 
QuestionHow to run a SQL script from the Web App setup? Pin
emartinezs13-Jan-04 6:15
memberemartinezs13-Jan-04 6:15 
AnswerRe: How to run a SQL script from the Web App setup? Pin
punk_zappa19-Jan-04 22:51
memberpunk_zappa19-Jan-04 22:51 
GeneralRe: How to run a SQL script from the Web App setup? Pin
S P S27-Mar-04 18:15
memberS P S27-Mar-04 18:15 
AnswerRe: How to run a SQL script from the Web App setup? Pin
ChainsawDon4-Feb-05 11:00
memberChainsawDon4-Feb-05 11:00 
QuestionCan you add the web setup project template to the standard edition of Visual C# Pin
dpeterso8-Jan-04 15:52
memberdpeterso8-Jan-04 15:52 
GeneralUsing /images/filename.jpg in vs.net Pin
Bill Sorenson7-Dec-03 10:31
sussBill Sorenson7-Dec-03 10:31 
Generalmultiples sites Pin
leonardo mattes28-Nov-03 1:29
sussleonardo mattes28-Nov-03 1:29 
GeneralRe: multiples sites Pin
ChainsawDon4-Feb-05 11:02
memberChainsawDon4-Feb-05 11:02 
Questionhow to copy aspx pages and other image files Pin
dotty5-Oct-03 19:26
sussdotty5-Oct-03 19:26 
AnswerRe: how to copy aspx pages and other image files Pin
Majid Shahabfar5-Oct-03 19:40
memberMajid Shahabfar5-Oct-03 19:40 
QuestionContent Files : how to add PDF files ? Pin
bluespot10-Sep-03 22:37
memberbluespot10-Sep-03 22:37 
AnswerRe: Content Files : how to add PDF files ? Pin
Majid Shahabfar10-Sep-03 23:38
memberMajid Shahabfar10-Sep-03 23:38 
GeneralRe: Content Files : how to add PDF files ? Pin
bluespot16-Sep-03 4:57
memberbluespot16-Sep-03 4:57 
GeneralRe: Content Files : how to add PDF files ? Pin
S P S22-Mar-04 19:32
memberS P S22-Mar-04 19:32 
AnswerRe: Content Files : how to add PDF files ? Pin
Anonymous28-Apr-04 4:55
sussAnonymous28-Apr-04 4:55 
GeneralRe: Content Files : how to add PDF files ? Pin
Anonymous15-Dec-04 6:28
sussAnonymous15-Dec-04 6:28 
GeneralDeploy Web Files to Remote Host Pin
Vinod Menon8-Sep-03 17:18
memberVinod Menon8-Sep-03 17:18 
GeneralRe: Deploy Web Files to Remote Host Pin
SchnickelG10-Sep-03 2:28
memberSchnickelG10-Sep-03 2:28 
GeneralRe: Deploy Web Files to Remote Host Pin
S P S22-Mar-04 19:29
memberS P S22-Mar-04 19:29 
GeneralAdding a database to a Web Application Setup Project Pin
El German7-Sep-03 20:35
memberEl German7-Sep-03 20:35 
GeneralRe: Adding a database to a Web Application Setup Project Pin
John Cardinal8-Sep-03 11:38
memberJohn Cardinal8-Sep-03 11:38 
GeneralDeploy/Setup ASP.NET web app to server w/ multiple websites in IIS Pin
zzix6-Aug-03 13:22
memberzzix6-Aug-03 13:22 
GeneralRe: Deploy/Setup ASP.NET web app to server w/ multiple websites in IIS Pin
Russq5-Jan-04 22:07
memberRussq5-Jan-04 22:07 
GeneralRe: Deploy/Setup ASP.NET web app to server w/ multiple websites in IIS Pin
Vagif Abilov25-Jun-04 8:10
memberVagif Abilov25-Jun-04 8:10 
GeneralChecking IE Explorer Version Pin
lieperik4-Aug-03 20:17
memberlieperik4-Aug-03 20:17 
GeneralRe: Checking IE Explorer Version Pin
Majid Shahabfar4-Aug-03 22:58
memberMajid Shahabfar4-Aug-03 22:58 
GeneralRe: Checking IE Explorer Version Pin
lieperik5-Aug-03 0:08
memberlieperik5-Aug-03 0:08 
GeneralRe: Checking IE Explorer Version Pin
sparrowIsaBird21-Jul-09 4:13
membersparrowIsaBird21-Jul-09 4:13 
GeneralOne step further, combine the installer into a single .exe file Pin
lieperik7-Aug-03 4:08
memberlieperik7-Aug-03 4:08 
GeneralRe: One step further, combine the installer into a single .exe file Pin
lieperik7-Aug-03 21:59
memberlieperik7-Aug-03 21:59 
Generalproblem Pin
sonex8-Jul-03 22:40
membersonex8-Jul-03 22:40 
Generalerror while trying to deploy the web application Pin
tanunav30-Jun-03 5:14
membertanunav30-Jun-03 5:14 
QuestionDeploying Web Applications with more than one project ? Pin
Lman19-Feb-03 14:37
memberLman19-Feb-03 14:37 
AnswerRe: Deploying Web Applications with more than one project ? Pin
S P S22-Mar-04 19:19
memberS P S22-Mar-04 19:19 
Generaldeploying web application Pin
maj20-Nov-02 8:04
sussmaj20-Nov-02 8:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170924.2 | Last Updated 1 Sep 2002
Article Copyright 2002 by Majid Shahabfar
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid