I’ve looked at using Cake (C# Make) for build automation in C#. The basics were to compile a solution/project using MSBuild and then run our automated tests with xUnit. Another common set of tasks that are performed in a build pipeline are:
Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.
- Create a NuGet package
- Push the NuGet package to Octopus Deploy
- Create an Octopus Deploy Release
NuGetFirst thing we need to do is to create a NuGet package. You have a couple options here, one is to create a nuspec and invoke the Nuget.exe to create your package. I’m going to choose an alternative which is to use the built-in Nuget support to generate our NuGet package all within code. I’ve added a new “Pack” task which is called from our “Default” task. This task will create our NuGet package when we run our build.ps1 Now when we run our build, we can see the Pack task was created our NuGet package: “CakeDemo.0.0.0.1.nupkg”
Octopus DeployCake has built-in support for Octopus Deploy. To get started, you need to include the OctopusTools in your build.cake file.
#tool "nuget:?package=OctopusTools"We can use the OctoPush method for pushing your newly created NuGet package to the Octopus Deploy NuGet Server.
4 thoughts to “Octopus Deploy in Your Cake (C# Make)”
Great article! Thank you for sharing your experiences with the community! Quick question… You mentioned that you are using the Cake.ExtendedNuGet package, but none of the code samples that you have shown are actually using it. All the methods that you show are those built into Cake. Can you confirm which aliases that are provided within the Cake.ExtendedNuGet package you are actually using? Thanks!
Actually, looks like there is a problem with our documentation 🙁 http://cakebuild.net/dsl/nuget Only the aliases in the General section are provided by the Cake.ExtendedNuGet package. All the other aliases ship out of the box within Cake. Sorry for the confusion here!
did you use it Windows ? any good patterns and practices in a real world sample?
You’re correct. NuGet Pack is apart of Cake.Common.Tools.NuGet. I’ll update the post. Thanks for the correction!