Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 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
Introduction:

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

Description:
  
In previous post I explained many articles relating to
Asp.net, 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="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Sample Page to Create Setup Files</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table width="50%">
<tr>
<td>
<p>
<img alt="Aspdotnet-Suresh" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJ3C-tQDXPIMmR_dS4yVjSxehkRh6cA3XmKuGynVFcv0my1TMzWis9ucLgUvpBhQ76zwFfKrp5SieMfZjZmiWdk8DCcL8rlv315aRPY8u3RjzO1zBros0Dm9NtVljyBYMtukeEmxuR01Q/">
</p>
<p>
Aspdotnet-Suresh offers Asp.net,C#.net,SQL Server,Web Services,WCF,WPF,MVC,Crystal Reports,AJAX,XML,JavaScript,JQuery,Gridview articles, samples and tutorials,code examples of asp.net 2.0,3.0,3.5,4.0 and Articles,examples of .net technologies
</p>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
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 Asp.net, C#.net, 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

43 comments :

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

PLEASE IAM WAITING 4 U R REPLAY SURESH GARU

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 asp.net+vb 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
-hasini

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

baijuep@gmail.com

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 vb.net and sql server, I have created website in vb.net 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
Nikita.ghag18@gmail.com

Unknown said...

Hi,
This is good but i need in visual studio 2012

abc said...

hi

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

indranmc said...

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

Go ahead..

Logendran

Sandeep Bhadauriya said...

Nice Article..
Thanks...

Anonymous said...

Hello,

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

Hello,
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?

Unknown 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

Unknown said...
This comment has been removed by the author.
Anonymous said...

Hi sir,

How we connect sql server db??
rajeshmanam@gmail.com

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 website...as per your direction i make setup it will run but can not connect to database....plz help me....
Thanks sir.
avnishrathod@gmail.com

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 solution..jai739@gmail.com

Anonymous said...

hi this is trinath I need .exe file in asp.net. 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..
grandhitrinath.mca@gmail.com

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.


Unknown 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...
srikanthk575@gmail.com

Optimist said...

Hi I had Success in Visual studio 2008 When i was Usign at my workplace but when this steps i follow in Windows 7 in visual studio 2010 following error arise during installation step : This setup requires internet information server 5.1 or higher and windows xp or higher.this setup cannot installed on windows 2000.please install internet information server or a newer operation system and run this seyup again.

Anonymous said...

i want to create a desktop icon for my default.aspx using setup

Anonymous said...

good

Sunil said...

Hi Suresh Sir,

I would like to Create An Stand Alone Application and Publish the project to get Exe,

Can i access the Exe as Web application?

Thank You

kovi said...

Hi,
How to create Desktop icon for IIS hosted asp project.

Unknown said...

Thank you sir...it is so helpful.....
Sir How can we do the same using Visual Studio 2012

sagar patil said...

i want to connect installed exe to sql server 2005

Unknown said...

my site url after browse from iis: http://localhost:8078/Ecommerce

but when i click on another link url change to: http://localhost:8078/Home

and webpage not open.

how can i solve it?

Hari Shankar Maurya said...
This comment has been removed by the author.
Hari Shankar Maurya said...

Hello sir I want to make set up of a .net web application that has been made in visual studio 12. It's not displaying web set up tools . how can i make set of it?

Unknown said...
This comment has been removed by the author.
Unknown said...

Please tell me how to connect this executable file with SQL Server database ?

Jagadish K said...

I have created a setup by following above instructions, successfully created a setup file.

Trying to install on windows 10 with IIS 10.0 it is throwing an error popup with message as below.

Error message:
This setup requires internet information server 5.1 or higher and windows XP or higher.
This setup cannot be installed on windows 2000. Please install internet information server or a newer operating system and run this setup again.

Unknown said...

Hi Sir,
I want deploy my application on end user machine,Is any need to install iis first? or setup will do all installation process with iis.

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

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