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

Create Installer (Setup) File for Asp.net Web Application

Mar 15, 2017
Introduction:

Here we will learn how to create installer for asp.net web application or create setup installer for asp.net website in visual studio to deploy web application file directly in IIS or create installer or setup file for asp.net application using visual studio with examples. In visual studio we can easily create setup file or installer file for web application using setup project module in visual studio.


Description:
  
In previous post I explained create windows forms setup file in c#, vb.net, setup local website with custom url in asp.net, install windows service using command prompt with example 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://lh5.googleusercontent.com/_B28NJpJ61hA/TdgnS7lh7mI/AAAAAAAAAi4/oLTicIRgEIw/FinalLogo.png">
</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

Create Installer (Setup) File for Asp.net Web Application

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

5 comments :

A1785 said...

This is awesome.... Thank you

Suma said...

GREAT

Anonymous said...

fhf

Anonymous said...

dgsd

Dev said...

You installed it on your local machine.

Can you please explain, how to do the same while deploying on client machine ???

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.