Using WebDeploy via Nuke Build Scripts

Georg Dangl by Georg Dangl in Continuous Integration Saturday, January 27, 2018

Saturday, January 27, 2018

Posted in DotNet IIS

Some days ago, I read about NUKE, which is kind of like Make, Cake and FAKE. Besides breaking the rhyme, it's looking really promising and takes an interesting approach for build configuration.

Update: I've now published the package on NuGet: Nuke.WebDeploy

I'm mostly using PowerShell scripts for all my automation, and have also tinkered a bit with dotnet script. PowerShell scripts are really easy to use, but complex tasks have a tendency to become brittle and, since I'm no where near being an expert, always require a bit of trial and error. Scripting with C# is great, but is often not easy to set up. Now there's NUKE, which lets you write build scripts in regular .Net projects. Overall, the experience with it was quite good for me, and I've migrated one of our projects at work already.

One of the missing bits in NUKE is the support for Microsoft WebDeploy. I'm using it a lot, both for deploying to Azure as well as IIS. Unfortunately, there's no NuGet distribution available for the command line utility, it must be installed on the machine executing the build. However, there's a Microsoft.Web.Deployment package on NuGet which exposes the complete WebDeploy API. I'm working on releasing a NuGet package for NUKE, based on Cake.WebDeploy. In the meantime, you can simply use the code on this Gist to deploy to Azure or IIS with WebDeploy using NUKE. This snippet shows a shortened build config. The Deploy target is executing WebDeploy:

You can simply build, publish and deploy your website with PowerShell, for example in a Jenkins build:

Happy building!

Share this post

comments powered by Disqus

About me

Hi, my name's George! I love coding and blogging about it. I focus on all things around .Net, Web Development and DevOps.


Need a consultant for BIM, GAEB or Software Development?

Contact me at [email protected], +49 (173) 56 45 689 or visit my professional page!

// Just 💗 Coding

Social Links