liveBook · Manning

Software template

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

A project template is a predefined .NET project structure and configuration used to generate initial application files.

A .NET project template generates the starting files and configuration for an application. Run `dotnet new --list` to see available templates, then pass a template’s short name to `dotnet new`. Templates are a starting point, not a decision about how every feature must work. section 4.1.1

Choose the starting point that matches the work:

  • `web` supplies the minimum code and content for ASP.NET Core development. It leaves room to add and configure features as they are needed. section 4.1.1 section 7.1
  • `mvc` starts an application configured for the MVC Framework; `webapp` starts one configured for Razor Pages. Other listed options include Blazor Server, Angular, and React. section 4.1.1
  • `globaljson` creates a `global.json` file to specify the .NET version; `sln` creates a solution file for grouping projects. section 4.1.1
Listing 4.2 Creating a new project
dotnet new globaljson --sdk-version 7.0.100 --output MySolution/MyProject
dotnet new web --no-https --output MySolution/MyProject --framework net7.0
dotnet new sln -o MySolution
dotnet sln MySolution add MySolution/MyProject

This command sequence pins SDK version 7.0.100, creates a minimal `net7.0` web project, creates a solution, and adds the project to it. section 4.1.1

A fuller template can get an application running quickly, but its placeholder content and configuration embody assumptions. If those choices are unfamiliar, start with `web` and add features deliberately; use a fuller template when you know how to adapt it. section 2.2 section 4.1.1

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

How deep it goes
Explains template selection and setup commands, while treating generated features as configuration to inspect rather than internals to trace.
Examples
Uses command sequences for a minimal web project and an MVC project, each paired with a solution.
What it assumes
Introduces `dotnet new` commands without requiring prior knowledge of MVC, while assuming access to the .NET SDK and a command prompt.
What you can do after
Operate/configure it by listing templates, generating a project, and choosing a minimal or preconfigured starting point.
How it connects
Connects project templates to ASP.NET Core, MVC, Razor Pages, `global.json`, and solution files.

Also explained in

Compare how 3 books explain software template →

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.