aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Visual Studio Create Setup project to deploy web application in IIS

Apr 10, 2012

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

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


srinivas said...

hi suresh this is ok so how the database will be install along with set up please urgent .........

srinivas said...

please suresh this urgent requirement for me that database also should be install along with setup

srinivas said...


srinivas said...
This comment has been removed by the author.
Baiju EP said...

i has proceeded as directed. click on Project Output it will opens another window to select required output files in that window only Content Files ia available (Primary Output is not seen) what will be the reason.
i was trying to create web setup for my web. and i don't want to copy source code (.vb file)

Anonymous said...

hi suresh,
in websetup deployment i am not able to find primary output files, only content files are coming, plz help how to solve this problem

Baiju EP said...

hi suresh,
in websetup deployment i am not able to find primary output files, only content files are coming, plz help how to solve this problem

Baiju EP said...

hi suresh,
in websetup deployment i am not able to find primary output files, only content files are coming, plz help how to solve this problem

akash said...

Baiju EP you might be created a website instead of web-application..In case of website you can't find primaryOutput because it isn't compiled..try again by creating web-application as Mr.Suresh instructed in this article..

Nikita said...

hello sir,
I am fresher working on and sql server, I have created website in now i want to create exe of that and run it on another machine , i followed your given steps and created setup but its unable to run on other machin. what will i need to do?
please guide

Govardhana B said...

This is good but i need in visual studio 2012

abc said...


Rajkumar Chavan said...

HI Suresh,
You have given very useful document here.but i have would like automatically popup main form after completion of successfully run the set up .
Please help if any idea about that.
Rajkumar Chavan

Anonymous said...

How to create short cut key for this application on Desktop?

Anonymous said...

How can deploy enabled application(Means Asp.Net applicaion with Sql Server database)...............?

Anonymous said...

Please it's Urgent Requirement.

Indran said...

Good Work Suresh...
valuable Note to begineers...

Go ahead..


Sandeep Bhadauriya said...

Nice Article..

Anonymous said...


It's working fine, My question is if I have again install it that it would we ask me repair or uninstall. But if I have create same setup with different machine. And install it. it would we show me error like..
"Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel"

Please Help Me.

chirag said...

i want to make my software single user, when any user use one time in one computer so after that not use in other computer.
so please say me how can do this?

viji durga said...

Its very useful but in build i cannt get the content in add project output Group. Please claify me..

Anonymous said...

good site and useful informations thanks for the site keep it up

Namita Sethi said...
This comment has been removed by the author.
Anonymous said...

Hi sir,

How we connect sql server db??

Anonymous said...

hello sir...

i am working with .net 2010 and default database of .net 2010(sqlexpress 2008r2).
i make website and i want to create setup of this per your direction i make setup it will run but can not connect to database....plz help me....
Thanks sir.

Anonymous said...

In deployment i can't able to find primary output files only it's displaying content files alone...pls suggest me to find the

Anonymous said...

hi this is trinath I need .exe file in i done step 5 in the above program but step 6: my program shows only 'content file' it didn't show the primary output...plz help me

Thanks sir..

Anonymous said...

hai sir.

iam installing setup file in iis but the website right click explorer select my source code is visible please tell me what i can do not visible my source code.

Srikanth Karri said...

Hi Suresh SIr,

After Installing setup file in that reports and XSD files are not coming.Please give the Soultion for that. In Setup file Creation time i selected Primary Output and Content FIles only.

Thanks Sir...

Give your Valuable Comments

Other Related Posts

© 2010-2012 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.