liveBook · Manning

.NET tool

As explained in ASP.NET Core in Action, 3e

A .NET global tool is a .NET CLI tool installed for use across projects and invoked from the command line.

A .NET tool is cross-platform command-line tooling that extends the .NET SDK. Installed globally, it can be invoked from the command line and used across projects. section 11.4.2 section 12.3.1

For OpenAPI clients, install the Microsoft .NET OpenAPI tool globally, add an OpenAPI reference to a console project, and build. The tool downloads the API description and generates a strongly typed C# client through NSwag. section 11.4 section 11.4.2

A typical OpenAPI client workflow is:

  • Run the API and make its OpenAPI JSON document accessible. section 11.4.2
  • Add the document with dotnet openapi add url, saving it locally such as OpenAPIs\fruit.json. section 11.4.2
  • Add the client-generation packages, then build to generate the C# client. section 11.4

Generated OpenAPI client

An OpenAPI reference can specify the local document, namespace, and generated class: <OpenApiReference Include="OpenAPIs\fruit.json" SourceUrl="http://localhost:5062/swagger/v1/swagger.json" Namespace="Fruit" ClassName="FruitClient" />. Building the project then produces a FruitClient with serialization and deserialization support. section 11.4

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains installation, project references, packages, and build-time generation, but does not detail the tool's internal implementation.
Examples
Uses Microsoft.dotnet-openapi, a fruit API document, FruitClient, and dotnet-ef as concrete command-line examples.
What it assumes
Assumes a .NET project and accessible API description for OpenAPI generation, while introducing global-tool installation and invocation.
What you can do after
Apply it via Microsoft.dotnet-openapi or dotnet-ef to automate API client generation or EF Core migration tasks.
How it connects
Connects .NET tools with OpenAPI, NSwag, NuGet, build processes, and strongly typed C# clients.

Also explained in

Compare how 2 books explain .NET tool →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.