Mattias Karlsson and the On .NET Live team demonstrate how developers can use Cake.Sdk and modern .NET to write maintainable DevOps scripts as C# apps, simplifying automation and improving the developer experience.

On .NET Live: Using Cake.Sdk for C# DevOps Automation

Overview

In this episode, Mattias Karlsson, Maira Wenzel, Scott Addie, and Frank Boucher explore how to use Cake.Sdk with the latest .NET versions to create DevOps definitions as file-based C# applications. This approach brings the power of the full IDE, debugging, and Cake APIs into modern build and automation workflows.

Key Highlights

  • File-Based C# DevOps Definitions: Learn how to build automation scripts as standalone C# files (cake.cs), moving away from traditional build scripting approaches.
  • IDE Integration: Take advantage of features like code completion, refactoring, and debugging in Visual Studio or any C# IDE.
  • Cross-Platform Support: Run the same DevOps automation scripts across different platforms and environments, thanks to .NET’s cross-platform capabilities.
  • Using Cake APIs: Harness Cake’s rich set of APIs for build orchestration, dependency management, and more.
  • Clean and Maintainable: C# scripts offer a modern, readable alternative to legacy build script languages, enhancing maintainability.

Getting Started Steps

  1. Install .NET and Cake.Sdk
    • Ensure .NET SDK is available on your system.
    • Add Cake.Sdk NuGet package to your project.
  2. Create a cake.cs File
    • Write your build and automation logic in a C# script.
  3. IDE Setup
    • Open the script in Visual Studio or a C#-friendly editor for full IntelliSense and debugging support.
  4. Execution
    • Run dotnet run cake.cs to execute your automation tasks locally or in CI/CD environments.

Benefits

  • Developer Productivity: Write and debug DevOps scripts with familiar C# workflows.
  • Consistency: Use the same language and tools across development and automation tasks.
  • Scalability: Portable scripts can be shared and reused across projects and teams.

Additional Resources


Featuring: Mattias Karlsson, Maira Wenzel, Scott Addie, Frank Boucher