1

We have a solution which consists of several projects. Some of the projects are windows tasks, some are windows services and some are mvc-websites which are running on a remote server. On this server we are currently implementing TeamCity as CI server for automating our builds and deployments. As of now, the projects are deployed on this same server. The build, test steps etc works fine but I am not sure how to deploy the tasks and services. All tutorials about this subject (at least those I have seen) only concerns deployment of websites.

The most obvious way is to have a post-build step running a powershell script which are uninstalling the current running windows service, removes the old service, copy the new dll and start the service again. The windows task files could simply be replaced directly with the new version.

However, I do not like this solution, it feels very blunt and could perhaps be hard to implement if the deployment server is remote.

Does anyone have any better suggestion on how to make the deployment?

Have a nice day!

olif
  • 3,221
  • 2
  • 25
  • 23
  • Would it be accepatable to run an msi installer to replace the old service as a post-build step? in this case you might want to check this answer http://stackoverflow.com/questions/4743064/windows-service-deployment. Hope it helps. – Andrea Scarcella Apr 16 '13 at 20:07
  • Unfortunately no, thank you for your answer anyways. – olif Apr 16 '13 at 20:14

3 Answers3

3

Try to look at Octopus depoy: http://octopusdeploy.com/. You can easy integrate it with TeamCity. It has abillity to star/stop service and much more. Moreover it use nuget packages.

Piotr Stapp
  • 19,392
  • 11
  • 68
  • 116
1

You can deploy windows services via Web Deployment Tool as well. All you have to do is to create manifest.xml file with runCommand (un/install and start/stop service) and dirPath (deploy service) providers.

My manifest file which deploys also DB and web site looks like:

<sitemanifest>
  <dbDacFx path='$dbSource' />
  <runCommand path='$presync' waitInterval='30000'/>
  <dirPath path='$winSource' />
  <runCommand path='$postsync' waitInterval='30000'/>
  <IisApp path='$webSource' managedRuntimeVersion='v4.0'/>
  <setAcl path='$webSource' setAclResourceType='Directory'/>
  <setAcl path='$webSource' setAclResourceType='Directory' setAclUser='anonymousAuthenticationUser'/>
</sitemanifest>

It's generated by build script in Psake, but you can do it as you wish.

I wrote two blogs about this topic, but they are in czech language.

Hope, there is something that can help you.

Aleš Roubíček
  • 5,198
  • 27
  • 29
0

Inedo's BuildMaster can pick up right where TeamCity leaves off using the BuildMaster TeamCity Extension. There's a free version avaiable that will probably solve your requirements.

We have to solve this own problem when we use BuildMaster to build/deploy BuildMaster (before installers get built), and if you take a look at the BuildMaster Specifics (Inedo.com > Support > Specifics > BuildMaster, you can see precicely how we stop/deploy/start the Windows service.

Karl Harnagy
  • 717
  • 5
  • 10