Click here to Skip to main content
Click here to Skip to main content

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


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.


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


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 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.

Comments and Discussions

QuestionAccessing The Deployed Project PinmemberAndile Mkhumane10-Apr-12 4:29 
QuestionHow to Generate the URl. PinmemberAustinRocks201010-Mar-10 18:55 
GeneralNot Bad , i could Follow PinmemberVuyiswa Maseko22-Jan-09 3:31 
GeneralThanks! PinmemberTony Rabun, MCITP30-Jul-08 9:32 
QuestionInclude new Folder Pinmemberaigama27-Nov-07 22:51 
AnswerRe: Include new Folder PinmemberMajid Shahabfar27-Nov-07 23:21 
GeneralRe: Include new Folder Pinmemberaigama27-Nov-07 23:25 
GeneralRe: Include new Folder Pinmemberaigama28-Nov-07 3:14 
Questioni need how to deployee PinmemberPrabhukarthik18-Apr-07 20:54 
Questionplease help PinmemberMember #383479813-Mar-07 21:56 
Generaladd folder on target machine Pinmemberpuiutzz5-Feb-07 2:53 
Generaladd folder on tare Pinmemberpuiutzz5-Feb-07 2:53 
GeneralCreate Web setup project Pinmemberkm.Sumit5-Feb-07 0:45 
GeneralCreate Web setup project Pinmemberdtchinh6-Nov-07 23:53 
GeneralDotNetFrameWork in Web Setup Project Pinmembernarcis050526-Sep-06 20:09 
QuestionAdd comtent files to set up project PinmemberArch22k30-Aug-06 22:25 
QuestionHow to create the setup Pinmemberstrongmind9-Jul-06 22:07 
GeneralMost helpful PinmemberIyad Abu Abdu30-Mar-06 3:48 
GeneralAdd/Project Output and Primary Output and Content Files Pinmemberamalien5-Mar-06 10:32 
Generalhi all Pinmemberzeny8427-Feb-06 23:16 
GeneralRe: hi all PinmemberDY_public1-Mar-06 7:54 
GeneralRe: hi all PinmemberHimaBindu Vejella2-Apr-06 19:45 
GeneralDepoly manually at another PC Pinmembersugardaddy227-Nov-05 3:34 
GeneralRe: Depoly manually at another PC PinmemberRubysbox27-Mar-07 0:58 
GeneralContent Files PinsussAnonymous18-Oct-05 22:21 
GeneralRe: Content Files Pinmemberdaniero8-Nov-05 6:46 
GeneralWeb Setup in Windows 2003 IIS 6.0 Pinsusspepe_el_ornitorrinco13-Sep-05 10:06 
GeneralDeploying Web Applications PinmemberAghatti9-Jul-05 5:36 
GeneralS.O.S (DATAGRID) Pinmembermcansin16-Mar-05 4:01 
GeneralCreating multiple virtual directories !! PinmemberJohnson Thomas C6-Oct-04 21:53 
GeneralRe: Creating multiple virtual directories !! PinmemberChainsawDon4-Feb-05 11:55 
GeneralDeploy Web App manually PinmemberAubyone15-Aug-04 22:05 
GeneralRe: Deploy Web App manually Pinmemberdaniero8-Nov-05 6:54 
GeneralINtegrating interface with aspx PinsussAshwin Murali5-Jul-04 8:21 
GeneralDeploying webapp on server w multiple sites Pinmemberflab00722-Jun-04 11:52 
GeneralRe: Deploying webapp on server w multiple sites Pinmemberflab00724-Jun-04 1:51 
GeneralRe: Deploying webapp on server w multiple sites PinmemberChainsawDon4-Feb-05 11:53 
GeneralWindows 2003 & IIS 6.0 PinsussFrancois Laperriere28-Apr-04 14:42 
GeneralRe: Windows 2003 & IIS 6.0 PinsussFrancois Laperriere28-Apr-04 16:30 
Generaladding user groups Pinsusssanpsan31-Mar-04 20:47 
QuestionHow to run a SQL script from the Web App setup? Pinmemberemartinezs13-Jan-04 7:15 
AnswerRe: How to run a SQL script from the Web App setup? Pinmemberpunk_zappa19-Jan-04 23:51 
GeneralRe: How to run a SQL script from the Web App setup? PinmemberS P S27-Mar-04 19:15 
AnswerRe: How to run a SQL script from the Web App setup? PinmemberChainsawDon4-Feb-05 12:00 
QuestionCan you add the web setup project template to the standard edition of Visual C# Pinmemberdpeterso8-Jan-04 16:52 
GeneralUsing /images/filename.jpg in PinsussBill Sorenson7-Dec-03 11:31 
Generalmultiples sites Pinsussleonardo mattes28-Nov-03 2:29 
GeneralRe: multiples sites PinmemberChainsawDon4-Feb-05 12:02 
Questionhow to copy aspx pages and other image files Pinsussdotty5-Oct-03 20:26 
AnswerRe: how to copy aspx pages and other image files PinmemberMajid Shahabfar5-Oct-03 20:40 

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

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

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