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.