liveBook · Manning

.NET SDK

As explained in Pro ASP.NET Core 7, Tenth Edition

The software development kit that provides the .NET command-line tools, libraries, and project templates for building .NET applications.

The .NET SDK supplies the command-line tools and project templates used to create, manage, build, and run ASP.NET Core projects. Its `dotnet` commands work regardless of whether you edit code in Visual Studio or Visual Studio Code; an editor is not a substitute for the SDK. section 4.1 section 4.0

Set up and check the SDK before creating a project:

  • Install the .NET 7 SDK separately if necessary. Visual Studio may install an SDK, but not the required version; Visual Studio Code does not install one. section 2.1.1 section 2.1.3
  • Open a new PowerShell prompt and run `dotnet --list-sdks`. Check for a `7.0.1xx` entry; other SDK versions may also appear. section 2.1.1 section 2.1.3

For a repeatable ASP.NET Core setup, `dotnet new globaljson --sdk-version 7.0.100 --output FirstProject` creates a `global.json` file that specifies the SDK version. `dotnet new mvc --no-https --output FirstProject --framework net7.0` then uses the SDK’s MVC template to create a project targeting .NET 7. The template includes placeholder content: useful for getting started quickly, but not a reason to treat the generated application as a black box. section 2.2

Listing 2.3 Creating a new project
dotnet new globaljson --sdk-version 7.0.100 --output FirstProject 
dotnet new mvc --no-https --output FirstProject --framework net7.0
dotnet new sln -o FirstProject
dotnet sln FirstProject add FirstProject

The complete command sequence shows how to create the version file and MVC project, then create a solution and add the project to it. section 2.2

Build, run, and check the result

From the project folder, run `dotnet build` to build it, or `dotnet run` to build and start it. In the shown application, static-file support is enabled in `Program.cs` and the HTTP port is set to 5000; requesting `http://localhost:5000/demo.html` displays the static HTML file. section 4.3

The command line also supports adding packages and installing tool commands. Visual Studio exposes some development tasks through its interface, but not every required feature is available through an editor or IDE. section 4.0

How Pro ASP.NET Core 7, Tenth Edition covers it

How deep it goes
Gives installation checks and executable project commands, stopping short of explaining SDK internals.
Examples
Shows `dotnet --list-sdks`, an MVC project and solution command sequence, and `dotnet build` and `dotnet run` followed by a browser check.
What it assumes
Assumes a Windows PowerShell prompt and an installed editor, while giving instructions to install and verify the SDK.
What you can do after
Operate/configure it to verify the installed SDK, create a version-specified ASP.NET Core project, and build and run it.
How it connects
Connects the SDK to ASP.NET Core, MVC project templates, global.json, Visual Studio, and Visual Studio Code.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro ASP.NET Core 7, Tenth Edition. The section links point to the parts of the book it draws on.