I have an ASP.NET web site - aka, I don't need to build the project and deploy dlls along with the project, I just place the .aspx and .aspx.cs files on my web server and things are compiled automatically.
I would like to setup TeamCity as a continuous integration server for this project so that it will only deploy the files that were checked in rather than updating every file in the project when I leave a specifically formatted comment during checkin.
So far I was able to setup a build trigger that only fires if the comment is formatted correctly, but I can't find a way to tell TeamCity to only deploy the files that have been checked in rather than the entire project.
Can this be done? If so, can someone point me in the right direction?
I would use Microsoft's WebDeploy. It will automatically deploy only the files that have changed.
Troy Hunt's guide to setting up build and deployment in Team City along with WebDeploy is an excellent place to start:
http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html
Also, if you prefer a more manual approach, you could use RoboCopy to do a sync:
http://itbloggertips.com/2013/05/robocopy-command-copy-only-new-changed-files-sync-both-the-drive/
Related
i am looking for a way to autodeploy a Dot Net Nuke website by TFS after checking in. I also need to some how transform web config to the right connection for the deploy server.
Since this is a website but not a web application, thing becomes tricky. If you have done it before, please give me some idea.
Thanks
I have not done auto deployment with TFS but did automate the process with SVN. What we did is simply have the script deploy everything that had changed since last login to the web server - EXCEPT - the web.config.
Database scripts were handled by a process like this but those were not as reliable as the SVN code deployment was.
HTH
You could use a deployment tool such as kwatee (self promotion). Kwatee is configured via a web GUI and can then deploy any application or site via python scripts and transform files along the way.
You can use Visual Studio web deploy feature. ALM Rangers shipped a ready to use BRDLite Reference template for this purpose which you can download here. Also, check this link for documentation for the template usage.
If you're using VS2010, you can use a Web Deploy Project in your solution. TFS will talk to the WDP as it would with a web application's project file.
For config transforms, you can use a tool called SlowCheetah.
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/
Currently, I'm maintaining an older ASP.NET website. In the solution, there exists 5 C# projects which build to assemblies as well as the development server's web directory. Normally, I do whatever work needs to be done (adding pages, making changes to existing projects, etc), build the projects (the current output path is my development server's wwwroot\bin\ directory) and if all is well, I open Windows Explorer and drag either .aspx or .dll files from the dev server to the production server. It's that last step that I'm wondering if there is a better way of doing. Does anyone have a different way of doing things where you don't have to leave Visual Studio to push updates?
You should add a Web Deployment Project, that´s (in my opinion) the easiest/best way to deploy a Asp.net app
Here´s an interesting article from the MSDN Magazine. http://msdn.microsoft.com/en-us/magazine/cc163448.aspx
ASP.NET Web Site Precompilation Overview would seem to be what you are wanting, yes?
Otherwise, there are web deployment projects for VS 2005 and web deployment projects for VS 2008 if you want a couple of alternatives depending on which version of Visual Studio you use.
How old is older? Are you using ASP.Net 1.0, 1.1, or 2.0, as those are what I'd consider older, but then I've been doing web development for over a decade.
You might want to consider creating a build script and a deployment script. You can look at using either Nant or MS Build, which are popular, or simply go with a batch file approach.
Some of the reasons I suggest going with scripts are:
1. You'll never forget to push that one file that you added
2. Either your build script or your deploy script should create a copy of all the artifacts need for deployment. This way, if you push out a bad build and need to roll back for whatever reason, guess what, you have a working copy tucked away somewhere.
3. Your scripts can run the installers (if you created a setup project) or they can simply copy out the files to the correct location, so that you don't have to have your dev box pointing to the right folder.
4. Sometimes you need to make changes to the configuration before you deploy... your scripts can also do this for you.
In general automating the whole process just makes it easier, faster and repeatable.
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
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.