Dotnet Operations
Build, test, and publish .NET projects using the dotnet CLI.
Operations
| Operation | Description |
|---|---|
Dotnet.Restore | Restore NuGet packages for a project. |
Dotnet.Build | Compile a project with optional configuration. |
Dotnet.Test | Run unit tests for a project. |
Dotnet.Publish | Create deployment artifacts with full publish options. |
Dotnet.Tool | Create a reference to a .NET CLI tool for installation. |
Example
Build and publish a .NET application.
build.ando
// Define project references
var App = Project.From("./src/App/App.csproj");
var Tests = Project.From("./tests/App.Tests/App.Tests.csproj");
// Restore, build, and test
Dotnet.Restore(App);
Dotnet.Build(App, o => o.Configuration = Configuration.Release);
Dotnet.Test(Tests);
// Publish as self-contained single file
Dotnet.Publish(App, o => o
.Output(Root / "dist")
.WithConfiguration(Configuration.Release)
.WithRuntime("linux-x64")
.AsSelfContained()
.AsSingleFile());