SDK directive

The SDK directive is used to reference a .NET SDK from NuGet. This is equivalent to specifying the SDK in a .csproj file.

Usage

The directive has one parameter which is the SDK name, optionally followed by a version.

Reference SDK from NuGet

#:sdk Cake.Sdk

This is equivalent to the following .csproj:

<Project Sdk="Cake.Sdk" />

Reference SDK from NuGet with version

You can specify a version in two ways:

Versioned in global.json

#:sdk [email protected]

This is equivalent to the following .csproj:

<Project Sdk="Cake.Sdk/6.0.0" />

Versioned in file

The version can also be specified directly in the directive:

#:sdk [email protected]

This is equivalent to the following .csproj:

<Project Sdk="Cake.Sdk/6.0.0" />

See also