Cake v0.35.0 released

Cake Build
2 min readSep 28, 2019

--

Version 0.35.0 of Cake has been released.

We’re truly excited by this release which has some amazing features and improvements!

In this blog post we’ll highlight:

  • .NET Core 3 support
  • C# 8
  • Runtime identification & compiler constants

Contributions were included from:

Full details of everything that was included in this release can be seen below.

.NET Core 3 support

Cake.Tool is now, in addition to .NET Core 2.1, also compiled for .NET Core 3.0 using .NET Core 3 RTM SDK.

This means Cake is built and tested to be able to run without modification in a pure .NET Core 3 environment.

Installing Cake.Tool

dotnet tool install --global Cake.Tool --version 0.35.0

Executing Cake.Tool

dotnet cake build.cake

C# 8

Cake now ships with Roslyn 3.3.1, which will provide C# 8 support in your Cake scripts when running Cake.Tool on .NET Core 3.

Example C# 8

// Switch expression
static string ToLevel(this Verbosity verbosity)
=> verbosity switch
{
Verbosity.Diagnostic => "[****]",
Verbosity.Verbose => "[*** ]",
Verbosity.Normal => "[** ]",
Verbosity.Minimal => "[* ]",
Verbosity.Quiet => "[ ]",
_ => throw new ArgumentOutOfRangeException(message: "invalid enum value",
actualValue: verbosity,
paramName: nameof(verbosity)),
};
Verbosity[] verbosities = null;// Null-coalescing assignment
verbosities ??= (Verbosity[])Enum.GetValues(typeof(Verbosity));
// Range last 4
foreach(Verbosity verbosity in verbosities[^4..])
{
Information(
"{0} = {1:F}",
verbosity.ToLevel(),
verbosity
);
}

Output

[* ] = Minimal 
[** ] = Normal
[*** ] = Verbose
[****] = Diagnostic

Runtime identification & compiler constants

Runtime identification and detection has been improved, so now Cake will not just compile scripts as .NET Standard but the actual .NET Core runtime it’s running under. This for example means Cake can now fully utilize a NuGet package compiled for .NET Core 3.

As Cake will now have different language features depending on which .NET Framework / Runtime it’s running under we’ve introduced the same preprocessor symbols you generally get in regular C# with one Cake specific addition.

This lets you if needed detect and adapt script based on runtime at script compile time.

Example Usage

#if (CAKE)
Information("Running on Cake.");
#else
Console.WriteLine("Not running on Cake.");
#endif
#if NETFRAMEWORK
Information("Running on .NET Framework.");
#elif NETCOREAPP
Information("Running on .NET Core.");
#else
Information("Running on something else.");
#endif
#if NETCOREAPP3_0
Information("Running on .NET Core 3.0.");
#endif

Issues

As part of this release we had 10 issues closed.

Features

Improvements

  • #2625 Add NuGet Push -SkipDuplicate Flag.
  • #2618 The MSTest tool doesn’t pick up the mstest.exe from Visual Studio 2019.
  • #2606 Unable to reference Newtonsoft.Json > 11.0.2.
  • #2601 Update Microsoft.CodeAnalysis.CSharp.Scripting to 3.2.1.
  • #2599 Update to Autofac 4.9.4.
  • #2585 Cake.Tool — How in the world do I run a specific task?.

Documentation

Bugs

  • #2610 Aliases of type ‘dynamic’ cannot be accessed directly.
  • #2608 TFBuildProvider.IsHostedAgent returns wrong value when running on 2nd build agent.

Originally published at https://cakebuild.net.

--

--

Cake Build
Cake Build

Written by Cake Build

Cake (C# Make) is a build automation system

No responses yet