Setting up TeamCity Deployment

1.1k Views Asked by At

Probably a easy question..

So I have team city running on our dev server and Continuous integration is setup where it builds the project anytime a push is made to my GitHub repository. I'd like to have it set up to deploy the project to the IIS Site anytime a push is made.

Simple right.. I think I just need to add a build step with a build script(msbuild, nant, etc) which copies code to the IIS site's hosted directory.

So my question is where does my build script need to copy the files from? From git or I assume teamCity pulled code down from git in order to build the project... I just don't know where teamcity placed the files. does anyone know where teamCity places these files?

Does this sound right? Extra points if you have a script that does this.

Thank you!!!

3

There are 3 best solutions below

2
On

You can do it a couple of different ways. For modern versions of TeamCity you can create a build step that will run against any of the standard 4 msbuild build targets (Build, Rebuild, Clean, Publish). If you include the Publish build target in your build step then TeamCity will deploy based on the settings on the Publish tab. This is the quickest and easiest way to go.

Teamcity checks out your code from source control and builds it in a folder local to the build agent that is running your build. If you have not installed any build agents on any other machines then the build agent is the one running on your Teamcity server. There are built in variables for the output location that you can use in your build steps, or you can specify your own if you want to build to a different output location.

If you want more flexibility then you'll need to develop a build script and there are nearly endless ways to do that.

0
On

I would use a product such a OctopusDeploy to handle deployments for you. You can have this up and running and deploying in a few hours.

There's a plugin for TeamCity that'll create a nuget package for you that can then be pushed out to Octopus deploy with very little effort. You can then setup a project to deploy a website in Octopus and it'll do all the magic such as AppPool configuration, IIS Bindings etc. And you can deploy to multiple machines without having to repeat what you're doing.

IMO this is the best way of deploying .Net applications and I implement and use this with TeamCity on a daily basis for my clients.

Octopus Deploy

0
On

Some basic recommendations how to setup deployment with TeamCity can be found here.