Deploy A Web Application in ASP.NET - asp.net

I want to deploy my ASP.NET application. Its not a "web site" it's a web application.
I'm looking
1) The quickest possible thing to do so I can start of testing
2) A more automated approach.
Any ideas?

Your fastest manner for getting it ready for testing is from the "Build" menu to select "Publish".
This will pre-compile everything and you can have it deploy to a folder, then set it up in IIS, change the connection string and you are set to go.
To "Automate" that process, you are going to most likely want to look at creating an install package.

If you're using MSBuild grab MSBuild community tasks # http://msbuildtasks.tigris.org/
And take a look at the WebDirectoryCreate task. There are plenty of other task libraries, but this is what I personally use.
If you're looking at changing configuration settings a simple xcopy and a folder naming structure was the simplest solution for me.
The quickest possible way is the publish command and setting up the virtual directory in IIS manually. I personally got sick of that so I went and looked into NANT and MSBuild.

Related

ASP.Net MVC 3 application automated installer

I wanted to know if it's possible to automate the deployment of an ASP.Net MVC application. This application is meant to run locally on the host PC and I what I want to do is create an installer to make it easy for end-users to setup quickly. I've never tried this approach for web applications and I wanted to see what my options are.
I was thinking of using something like Cassini or aspNETserve and somehow automating the installer to set everything up on the fly. Any insight is appreciated, if there are any questions or if more details are required, please let me know. Thanks.
I would use the WebPlatform installer to set all your dependencies setup. You can script that tool and have it run all the pre-reqs for you. (http://msdn.microsoft.com/en-us/library/windowsazure/gg433092.aspx)
Also, I would use IIS Express to host. It is also setup via script to setup your app root, paths, permissions, etc. (http://learn.iis.net/page.aspx/870/running-iis-express-from-the-command-line/)
So in theory a simple script or installer could deploy all of this for you and run the above two as well as deploying your application.

Continuous deployment of IIS settings with MSDeploy

We practice continuous deployment with TFS (2008) and are looking for a nice way to handle IIS settings changes. MSDeploy seems like it should be the way to handle this, but after much reading and searching, I haven't found a good answer.
The problem with MSDeploy, as I see it, is that you need to create a deployment package using an existing IIS website. I would like to be able to have the appropriate IIS configuration for the website in source control and have the build create the package.
The only way I can see to do this is to hand craft the archive.xml file. Is my thinking correct or is there a better way?
I ended up using powershell web administration module (with PSake for the build) to do this. I would still prefer to do this in a declarative manner.
I've been able to put a bunch of the website settings into my web.config so that they are in source control and easily deploy-able. Not all though. Some seem to get set higher up in the IIS hierarchy and then cannot be overridden by my web.config.
I've never found a way to do this with application pool settings.
For setting up new sites I wrote a small C# WinForms app that uses the programmatic interface to IIS to create the sites and app pools and change their settings. Probably similar to your PowerShell script.

Classic asp - How to automate deployment - in continuous integration environment

I've been doing some reading http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html and https://michaelbaylon.wordpress.com/2011/04/13/managing-sql-scripts-and-continuous-integration/ ... etc on automated deployment and continuous integration etc but non of it seems to talk about automated deployment in a classic asp environment and you can't really do proper CI unless you get into automated deployment.
Can MSDeploy deploy a classic asp website? If not ... is it best to just write a build script that copies all the files over to the correct folder and then start up IIS? I've done this using msbuild and the robocopy msbuild extension task. But then how do you handle the different environments (QA, dev, staging, production) there's no web config to put the different connection strings etc ... supposedly msbuild is configuration aware ... but how does that work when there is no web config?
So with all these questions I'm struggling to really move forward with creating a deployment script / module / exe for our classic asp website. Does anyone have any answers / resources / further questions that they can point me in the direction of?
Web Deploy (http://www.iis.net/download/WebDeploy) is the way to go. You just have to customize the deployment script for different environments.
You might find this links helpful:- http://msdn.microsoft.com/en-us/library/ms241740.aspx- "Build" Classic ASP with TFS 2010
MSDEPLOY can deploy anything that can live in IIS. You can create a package from the existing web site, and examine it to see what got packaged. You should be able to use that to determine how to package up your site from sources.
You should even be able to create a Visual Studio project from your sources so that you can use the Web Publishing Pipeline directly. The fact that there is nothing there to compile shouldn't stop you from specifying that your .ASP files are content files.
Checkout using cruisecontrol.net, we use that for our automated deploys along with msbuild and it works great. We are a .Net shop but it's basically the same thing. Cruise Control can run scripts and does handle the web.config / global.asa transformations pretty good. As long as you can script it cruise control could handle it.
Depending on your development environment you might be able to hook it into cruisecontrol. We use TFS and it integrates nicely so when we check items into our different branches (Dev, Main, Stage) it auto deploys the site to the appropriate location.
Deploying to our production environment we use MSbuild to move the code. Since it's in another network location we needed something that could go outside and do any server updates necessary.
http://cruisecontrol.sourceforge.net/

Best way to deploy a VS-2008 web project

what is the preferred method of deploying a web project? Just copy the dll's after compiling in release mode and registering them? or using NSIS to build an installer or the MS set up project.
I usually use a Web Deployment Project per WebSite or WebApplication, it allows me to manage build configurations, merging, and define pre-post build MSBuild tasks.
You can also take a look to the Microsoft Web Application Installer, it will be really nice, but it still in beta stage, however you can try it...
This depends greatly on where your webapp is going and the experience you wish to provide.
If you deploy to a web host its best to use xcopy deploy and documentation. If you have a real end system its simpler to create an installer to do all the leg work for your customers and maybe save your self some documentation work.
I would recommend investing in setting up a continuous integration process (CruiseControl.Net or TeamCity etc...) As you are probably not only going to deploy it to your customer only once.
Having an automatic deploy at the push of a button is a Godsend. If you invest a few days you can have automatic deploy to a dev-environment every time someone checks in code (and it compiles and all tests pass), set up daily deploys to a test environment and have a button to automatically deploy it to a staging environment whenever you want.
Andreas, I am in the process of getting CC.Net. In the meanwhile, I am using the Web Deployment Project. Using this and going through the set up, it creates a 'release' folder with a bin folder conntaining dll's and also the aspx in the parent folder.
I assume I can now create an MSI file using the 'release' folder or do i need to do something different to create an MSI which i can run on the client server

ASP.NET Web Application Build Output - How do I include all deployment files?

When I build my ASP.NET web application I get a .dll file with the code for the website in it (which is great) but the website also needs all the .aspx files and friends, and these need to be placed in the correct directory structure. How can I get this all in one directory as the result of each build? Trying to pick the right files out of the source directory is a pain.
The end result should be xcopy deployable.
Update: I don't want to have to manually use the Publish command which I'm aware of. I want the full set of files required by the application to be the build output - this means I also get the full set of files in one place from running MSBuild.
One solution appears to be Web Deployment Projects (WDPs), an add-on for Visual Studio (and msbuild) available that builds a web project to a directory and can optionally merge assemblies and alter the web.config file. The output of building a WDP is all the files necessary to deploy the site in one directory.
More information about Web Deployment Projects:
Announcement on webdevtools MSDN blog for WDP 2008
ScottGu introduction to WDP 2005
The only disadvantage to this solution is the requirement on an add-on which must be available on the build machine. Still, it's good enough for now!
ASP.NET doesn't have real xcopy deployment for new sites. It depends on having a virtual directory/Application in IIS. However, once that virtual directory is created you can use xcopy for updates.
You can Publish Web site..If you want to automate your deployment, you need to use some script.
Have you tried using the aspnet_compiler.exe in your .net framework directory? I'm pretty sure you can create a "deploy ready" version of a web application or web site.
The _CopyWebApplication target on MSBuild will do exactly what you need. The catch is that only the main assembly will be copied to the bin folder and that's why a copy task is needed to also copy any other file on the bin folder.
I was trying to post the sample script as part of this post but wasn't able to.
Please take a look at this article on my blog that describes how to create a MSBuild script similar to the one you need.
Have you tried right clicking the website in Solution Explorer and clicking 'Publish Website'?
Build --> Publish
A dialog box will appear that will guide you through the process.
For the automated building you describe in the update, I would recommend you look into MSBuild and CruiseControl.NET
It depends on how complicated solution you need, you could just use a script and jenkins for example. You can use MSBUild with Jenkins for just deploying to an IIS. And if you got Jenkins other tools is pretty easy to connect into it later on. But if you just want to build, use a script that jenins execute every build that uses MSDeploy and it will work great.
This is how i do it, just to give you a feeling:
Sonarqube uses Gallio, Gendarme, FXcop, Stylecop, NDepths and PartCover to get your metrics and all this is pretty straight forward since SonarQube do this automatically without much configuration.
Here is Jenkins witch builds and get Sonar metrics and a another job for deploying automatically to IIS. I use a simple script one line that calls my MSBuild and wich URL, pass and user.
And Sonarqube, all metrics for my project. This is a simple MVC4 app, but it works great!:
If you want more information can i provide you with a good guide.
This whole setup uses MSBuild, too build and deploy the apps.

Resources