Visual Studio Create Setup project to deploy web application in IIS

Posted by imomins on October 8, 2012 at 12:50 AM

In this article I will explain how to create setup file in visual studio 2008/2010 to deploy web application file directly in IIS or in client machine or how to place
web application folder in c:\\inetpub\wwwroot folder by running setup file using

In previous post I explained many articles relating to, JQuery, and SQLServer etc. If we did any application and if it works perfectly then we will prepare published files and deploy our application in IIS.

If we want to deploy application in IIS we need prepare separate published files folder and create virtual path in IIS, point to our folder and need to change some properties to make it work through our IIS by doing all these things we will waste a lot of time.

Instead of doing all these things if we prepare one setup file and make it everything for us like prepare published folder, create virtual directory, set properties and create website in IIS just by simple install how is it? Nice right. 

It is very useful for us many situations like suppose if we do one application for client we need to deploy that application in client machine instead of giving all the files and instructions to deploy it in his machine we just give one simple setup file and once he run that will deployed all files in IIS and site will create automatically with all properties in system.

To create Setup file for our application follow below steps.

Step1: First Open visual studio ---> Create new Project (File ---> New ---> Project)

After that open Default.aspx page and write some code like this

<html xmlns="">
<head runat="server">
<title>Sample Page to Create Setup Files</title>
<form id="form1" runat="server">
<table width="50%">
<img alt="Aspdotnet-Suresh" src="">
Aspdotnet-Suresh offers,,SQL Server,Web Services,WCF,WPF,MVC,Crystal Reports,AJAX,XML,JavaScript,JQuery,Gridview articles, samples and tutorials,code examples of 2.0,3.0,3.5,4.0 and Articles,examples of .net technologies
Now run application output would be like this

Step 2: Our Project is ready with sample page Now Add new Setup project for our project for that
Go to File ---> Add ---> New Project

Step3: Whenever we click on New Project another window will open in that
Select Other Project Types ---> Setup and Deployment ---> Web Setup Project ---> Once we select Web Setup project give a name and click OK

Setp4: Now setup project has added to our application that would be like this

Step5: After add setup project open Solution Explorer ---> Right click on Setup project ---> Add ---> Project Output

Step6: Once we click on Project Output it will open another window to select required output files in that window select Primary Output, Content Files and click OK

Here we selected two options one is Primary Output and another one is Content Files because if we add Primary Output it will add only files which are in bin folder and if we select Content Files option also then it will add .aspx files and web.config file to setup project.

After Add Primary Output and Content Files to our Setup project that would be like this

Now you should rebuild your solution file and setup file once you rebuild it go to your project folder and check setup project folder you will find setup file you can run your setup file directly from that folder or right click on your setup project in visual studio and select Install

Once you click on Install it will display welcome wizard in some cases may be you have a chance to get error like “The installer was interrupted before application could be installed. You need to restart installer to try again” to solve this problem check this post the install was interrupted before application could be installed.

Now click next in next screen we will see options Site, Virtual Directory and Application Pool fill these options and click Next button

In next screen it will display Confirm Installation you need to click Next

Whenever we click on Next button that will start installation process in next screen like this

Once installation process completed then that will display installation completed successfully window 

Now open your IIS by type “inetmgr” in Run and check your IIS if that contain our installed application or not

Now your site is ready you can browse from IIS that will display output will like this 

Here we can uninstall this application easily for that Go to Setup project in visual studio Right click on it and you will find option Uninstall

Second way Go to Control Panel ---> programs --->Uninstall Program ---> Add or Remove Programs ---> select your installed sample right click on it and select uninstall

Categories: ASP.NET, IIS, C#

Post a Comment


Oops, you forgot something.


The words you entered did not match the given text. Please try again.

You must be a member to comment on this page. Sign In or Register