ASP.NET Core Practice Test

โ–ถ

When you start a new web project in .NET, asp net core templates are the first tool you reach for. These scaffolding blueprints generate a fully wired-up project skeleton โ€” middleware, dependency injection, routing, and configuration all pre-configured โ€” so you spend the first hour writing business logic rather than boilerplate. Whether you are building a REST API, a Razor Pages site, a Blazor app, or a gRPC service, there is an official template that gets you past the blank-screen problem in under sixty seconds.

When you start a new web project in .NET, asp net core templates are the first tool you reach for. These scaffolding blueprints generate a fully wired-up project skeleton โ€” middleware, dependency injection, routing, and configuration all pre-configured โ€” so you spend the first hour writing business logic rather than boilerplate. Whether you are building a REST API, a Razor Pages site, a Blazor app, or a gRPC service, there is an official template that gets you past the blank-screen problem in under sixty seconds.

Templates in ASP.NET Core are distributed through the .NET template engine, a cross-platform CLI tool that ships with every .NET SDK installation. Running dotnet new list in any terminal reveals dozens of available templates, each identified by a short name like webapi, mvc, or blazorserver. Microsoft curates a rich set of official templates, and the broader community contributes thousands more through NuGet, giving teams the flexibility to encode their own conventions into reusable starting points.

Understanding the anatomy of a template helps you choose the right one and avoid fighting the framework later. Each template bundles a specific combination of NuGet packages, middleware registrations, folder structures, and configuration files. The webapi template, for example, configures JSON serialization, disables Razor views, and adds OpenAPI (Swagger) support by default in .NET 6 and later. The mvc template wires up view engines, tag helpers, and antiforgery tokens. Choosing the wrong template means spending time stripping out features you do not need or manually wiring ones you do.

Template versioning is closely tied to the .NET SDK version installed on your machine. When Microsoft releases .NET 8, the bundled templates reflect the new minimal hosting model, nullable reference types, and implicit usings patterns introduced in that cycle. If your team targets .NET 6 LTS but your SDK is .NET 8, you need to pass the -f net6.0 flag or install the SDK version that ships with the target framework templates. Mismatched versions are one of the most common sources of confusion for developers new to the ecosystem.

Custom organization templates are where the real productivity gains hide. Enterprise teams often encode standards โ€” logging configuration, health-check endpoints, OpenTelemetry setup, authentication middleware โ€” into a single internal template distributed via an internal NuGet feed. New developers joining the team run one dotnet new command and receive a production-ready skeleton that already passes the first CI pipeline check. This approach reduces onboarding time, eliminates configuration drift between microservices, and ensures that every project starts with the same security posture.

The template engine also supports template parameters, which let you toggle features at creation time. The official webapi template accepts flags like --auth Individual to scaffold ASP.NET Core Identity, or --use-program-main to generate a traditional Main method instead of top-level statements. These parameters make a single template behave like a family of related templates, dramatically reducing the number of templates you need to maintain. Understanding which parameters exist โ€” and what they generate โ€” is a core skill for any developer working seriously with ASP.NET Core.

This guide walks through every major built-in template, explains how to install third-party and custom templates, covers template parameters in depth, and shows you how to author and distribute your own organizational template. By the end you will have a clear mental model of the template system and the practical skills to streamline project creation across your entire team.

ASP.NET Core Templates by the Numbers

๐Ÿ“ฆ
30+
Built-In Templates
โฑ๏ธ
<60s
Project Scaffold Time
๐ŸŒ
1,500+
Community Templates
๐ŸŽฏ
8
Official App Types
๐Ÿ”„
LTS cycles
Template Updates
Try Free asp net core templates Practice Questions

Built-In ASP.NET Core Templates Overview

๐ŸŒ Web API (webapi)

Scaffolds a RESTful API project with controller routing, JSON serialization via System.Text.Json, OpenAPI (Swagger) documentation, and no view engine. Ideal for backend services consumed by SPAs or mobile clients.

๐Ÿ—๏ธ MVC (mvc)

Generates a full Model-View-Controller project with Razor view engine, tag helpers, antiforgery tokens, and Bootstrap. Best for server-rendered web applications with HTML responses and form submissions.

๐Ÿ“„ Razor Pages (webapp)

Creates a page-centric project where each URL maps to a Razor Page file rather than a controller. Simpler than MVC for CRUD-heavy applications and comes with Entity Framework Core scaffolding hooks.

โšก Blazor (blazorserver / blazorwasm)

Produces a component-based UI project. Server mode renders on the server over a SignalR connection. WebAssembly mode compiles C# to run natively in the browser with no server roundtrip for UI interactions.

๐Ÿ”— gRPC Service (grpc)

Scaffolds a Protocol Buffers-based RPC service with a sample <code>.proto</code> file, generated C# stubs, and Kestrel configured for HTTP/2. Suited for high-performance inter-service communication in microservice architectures.

Template parameters are arguably the most underused feature of the .NET template engine. When you run dotnet new webapi --help, the CLI prints a full list of flags that control what gets generated. The --auth flag is the most impactful: passing --auth Individual scaffolds a complete ASP.NET Core Identity setup with SQLite by default, including user registration, login, password hashing, and EF Core migrations. Passing --auth IndividualB2C instead wires up Azure AD B2C authentication. These options would take hours to configure manually and are generated correctly in seconds.

The --no-https flag is another common parameter, useful in containerized environments where TLS termination happens at the ingress layer rather than in the application itself. Removing HTTPS from the generated project eliminates the developer certificate dependency and the HTTP-to-HTTPS redirect middleware, which can cause unexpected behavior inside Docker networks where requests arrive on HTTP internally. Teams running Kubernetes with an NGINX or Traefik ingress almost always use this flag for internal services.

Framework targeting is controlled by the -f or --framework parameter. When you have both .NET 6 and .NET 8 SDKs installed, dotnet new webapi -f net6.0 generates a project with a <TargetFramework>net6.0</TargetFramework> entry in the .csproj and uses the implicit usings and nullable reference type settings from .NET 6. This is critical for teams maintaining long-term support services on an older runtime while developing new features on the latest SDK.

Top-level statements versus the traditional Program class with a Main method is controlled by --use-program-main. Top-level statements, introduced in C# 9 and the default since .NET 6 templates, reduce boilerplate to a minimum. However, some teams โ€” especially those with large codebases and junior developers โ€” prefer the explicit Main entry point because it is more familiar and easier to attach a debugger to programmatically. Passing this flag does not affect runtime behavior; it is purely a code style preference.

The --language parameter lets you scaffold in F# or Visual Basic instead of C#. The dotnet new webapi --language F# command generates an idiomatic F# project with a Program.fs file and functional-style route handlers. F# templates are less common in enterprise settings but are popular in data processing and financial services domains where the type system's discriminated unions and computation expressions provide strong correctness guarantees.

Output path and project name parameters โ€” -o and -n respectively โ€” control where the project is created and what namespace is used throughout the generated files. Running dotnet new webapi -n MyCompany.Orders.Api -o ./src/Orders generates a project in ./src/Orders with namespaces like MyCompany.Orders.Api.Controllers already filled in. This eliminates the tedious find-and-replace step that developers often perform after accepting a generic WebApplication1 default name.

Dry-run mode (--dry-run) previews exactly which files would be created without writing anything to disk. This is especially useful when evaluating an unfamiliar template for the first time. You can see the full file list, the parameter defaults that would be applied, and the output directory structure before committing. Combining dry-run with --verbosity diagnostic dumps the complete template metadata, letting you inspect every available parameter even if the documentation is sparse.

ASP.NET Core Authentication & Authorization
Test your knowledge of auth middleware, Identity, and JWT bearer tokens in ASP.NET Core
ASP.NET Core Authentication & Authorization 2
Advanced scenarios including claims, policies, and role-based access control in .NET apps

Choosing the Right ASP.NET Core Template for Your Project

๐Ÿ“‹ API vs MVC

The webapi template is the right choice when your application's primary contract is a JSON (or Protobuf) API consumed by a separate frontend or mobile client. It excludes Razor views entirely, keeping the project lean and startup time fast. The mvc template makes sense when your team owns both the server-side rendering pipeline and the data layer, and when SEO or initial page-load performance matters more than a fully decoupled architecture.

A critical decision point is whether your team has dedicated frontend developers comfortable with a JavaScript SPA framework. If yes, reach for webapi and let the frontend team own the UI layer independently. If your team is predominantly backend engineers who need to ship UI features quickly, the mvc or webapp (Razor Pages) template keeps all logic in C# and reduces the cognitive overhead of context-switching between languages. Neither choice is universally better โ€” it depends on team composition and delivery constraints.

๐Ÿ“‹ Blazor Considerations

Blazor Server and Blazor WebAssembly templates solve the same problem โ€” building interactive UI in C# โ€” but their runtime models differ substantially. Blazor Server keeps all component state on the server and pushes UI diffs over a persistent SignalR connection. This means low initial download size (under 200 KB) and full access to server resources, but it also means every user interaction requires a network roundtrip and a live server connection, which can become a scaling bottleneck under thousands of concurrent users.

Blazor WebAssembly downloads the .NET runtime and your application DLLs to the browser the first time a user visits, which can be several megabytes. After that initial load, interactions are fully client-side with no server roundtrip. The blazorwasm template includes a --hosted flag that adds an ASP.NET Core backend project alongside the Blazor client, giving you a single solution with a shared Shared class library for models. This hosted model is the most common production pattern because it allows seamless server-side API calls while keeping UI logic in C#.

๐Ÿ“‹ Minimal API vs Controllers

The webapi template in .NET 6 and later defaults to controller-based routing, but adding the --minimal flag switches to the Minimal API pattern introduced in .NET 6. Minimal APIs define HTTP endpoints as inline lambda functions in Program.cs, eliminating the controller class, action method attributes, and model binding infrastructure. For microservices with a small number of focused endpoints, this produces dramatically less boilerplate and measurably faster startup times โ€” benchmarks show Minimal API applications starting in half the time of equivalent controller-based apps.

Controller-based projects scale better organizationally when a service has dozens or hundreds of endpoints, because controllers group related operations, support action filters, and benefit from a rich ecosystem of tooling. Minimal APIs are catching up rapidly with features like route groups, endpoint filters, and typed results, but teams building large internal platforms still often prefer controllers for their familiar structure. The good news is that both styles coexist in a single project, so you can start with Minimal APIs and migrate specific controllers later without rearchitecting the whole application.

Pros and Cons of Using ASP.NET Core Templates

Pros

  • Eliminates hours of manual project setup and NuGet package configuration
  • Encodes Microsoft best practices like minimal hosting model and nullable reference types by default
  • Template parameters allow significant customization without maintaining many separate templates
  • Community and third-party templates extend coverage to frameworks like FastEndpoints, Clean Architecture, and more
  • Dry-run mode lets you preview generated files before committing to a scaffold
  • Custom organizational templates standardize security, logging, and CI configuration across all projects

Cons

  • Generated code includes demonstration boilerplate (WeatherForecast controller) that must be manually deleted
  • Template versioning is tightly coupled to SDK version, causing confusion when SDK and target framework differ
  • Custom template authoring requires learning the template.json schema, which has limited official documentation
  • Third-party templates on NuGet may be outdated, unmaintained, or incompatible with the current SDK
  • Overreliance on templates can mask the developer's understanding of what middleware and packages are actually wired up
  • Template parameter combinations are not always validated, leading to silent misconfigurations in edge cases
ASP.NET Core Authentication & Authorization 3
Deep-dive practice on OAuth 2.0, OpenID Connect, and external identity provider integration
ASP.NET Core Configuration & Environments
Practice questions on appsettings.json, environment variables, IConfiguration, and secrets management

ASP.NET Core Template Setup Checklist

Run <code>dotnet new list</code> to verify which templates ship with your installed SDK version.
Pass <code>--dry-run</code> before generating to preview all files and default parameter values.
Specify the target framework explicitly with <code>-f net8.0</code> to avoid SDK version mismatches.
Use <code>-n YourCompany.ProjectName</code> to set the namespace correctly from the first scaffold.
Choose <code>--auth Individual</code> or <code>--auth IndividualB2C</code> if authentication is needed from day one.
Add <code>--no-https</code> for containerized services where TLS termination happens at the ingress layer.
Delete the sample <code>WeatherForecastController</code> and its associated model before writing any real code.
Run <code>dotnet build</code> immediately after scaffolding to confirm no missing SDK components or restore failures.
Commit the unmodified scaffold as the first git commit so future diffs clearly show your changes.
Check NuGet.org for updated community templates if the built-in options do not match your architecture pattern.
The WeatherForecast endpoint is not a starting point โ€” delete it immediately

Every webapi scaffold includes a WeatherForecastController and a WeatherForecast model as a demonstration of how controllers work. These files serve no purpose in production code and will confuse security scanners and code reviewers. Make deleting these two files and their references in Program.cs the very first step in your post-scaffold workflow, ideally as part of your team's documented project creation runbook.

Creating a custom ASP.NET Core template begins with building a normal project that represents the ideal starting point for your team. Configure everything you want every project to have โ€” Serilog structured logging with a console and file sink, OpenTelemetry tracing with an OTLP exporter, a health-check endpoint at /healthz, global exception handling middleware, and your organization's standard NuGet package references. This project is your template source, and everything in it will be copied into each new project your team generates.

The key file that transforms a regular project into a template is .template.config/template.json. This JSON file tells the template engine the template's short name (used in dotnet new <shortName>), its human-readable name, a default project name, and the template's author and tags. The sourceName field specifies a placeholder string โ€” typically something like MyCompany.Template โ€” that the engine replaces with the -n argument value in every file name and file content. This is how namespaces, assembly names, and class names get customized at generation time.

Template parameters are defined in the symbols section of template.json. Each symbol has a type (parameter, computed, or derived), a data type (bool, string, choice), a default value, and a description. Boolean parameters are the most common: you might define an IncludeHealthChecks parameter that defaults to true, then wrap the health-check registration code in a conditional block using the template engine's #if / #endif preprocessor syntax. When a developer passes --IncludeHealthChecks false, the health-check code is simply excluded from the generated output.

File exclusion is handled via the sources and modifiers sections of template.json. You can specify that certain files are only included when a particular parameter is true, or that certain directories are always excluded (like a bin or obj folder). This is especially useful for templates that include optional integrations like Entity Framework Core โ€” the Data folder with your DbContext and migration configuration only appears in the generated project when the developer opts into database support at scaffold time.

Distributing your custom template is straightforward. Package it as a NuGet package (the package must contain the .template.config directory at the root) and push it to your internal feed โ€” Azure Artifacts, GitHub Packages, and JFrog Artifactory all work. Developers install the template with dotnet new install MyCompany.Templates, pointing the NuGet client at your internal feed. Updates to the template package are picked up by running the same install command with the new version number. Teams on a strict governance model can pin template versions in their developer environment setup scripts to ensure consistency across a large engineering organization.

Testing your template before distribution is important and often overlooked. The simplest test strategy is to run dotnet new install . from the template source directory, which installs the template from the local filesystem. Then generate a few projects with different parameter combinations and run dotnet build and dotnet test on each.

Automating these tests in a CI pipeline for the template repository itself โ€” treating the template as a product with its own release pipeline โ€” is a mark of a mature engineering organization and prevents broken templates from reaching developers at the worst possible moment, which is always the beginning of a new project.

Template inheritance and composition are emerging patterns in the ecosystem. Tools like Nuke and Cake build systems sometimes ship their own templates that build on top of the standard ASP.NET Core templates, adding build automation scripts and deployment targets. The template engine does not natively support inheritance, but you can achieve composition by defining multiple templates in a single NuGet package โ€” one for the API project, one for a test project, and one solution-level template that generates both and wires them into a .sln file with a single command.

Integrating ASP.NET Core templates into team CI/CD workflows transforms them from a convenience into a governance mechanism. When every service starts from the same internal template, your CI pipeline can make strong assumptions: the health-check endpoint exists at a known path, structured logs arrive in a known format, and OpenTelemetry spans use consistent attribute names. This predictability reduces the per-service configuration burden on the platform engineering team and lets them build reusable pipeline components that work across all services without custom exceptions.

A practical CI integration pattern is to add a template validation step to the template repository's own pipeline. On every pull request that modifies the template source, a workflow generates a sample project from the updated template, runs dotnet build, executes the generated unit tests, and runs a static analysis pass with dotnet format --verify-no-changes. If any of these steps fail, the PR is blocked. This ensures that the template source is always in a releasable state and that generated projects compile and pass tests out of the box.

Solution-level templates (dotnet new sln plus project templates in a single invocation) are particularly valuable for microservice architectures where each service follows a multi-project layout: an API project, a domain library, an infrastructure library, and a test project.

Nesting these into a solution template means a developer runs one command and receives a four-project solution with all project references already configured, a shared Directory.Build.props file enforcing consistent SDK settings, and a .editorconfig file with your team's style rules. The alternative โ€” manually running four dotnet new commands and three dotnet sln add commands โ€” takes significantly longer and introduces opportunities for inconsistency.

Template parameters can drive not just code generation but also infrastructure configuration. A common pattern is to include a docker-compose.yml and Dockerfile in the template, with the service name and port number derived from the template's -n argument via the sourceName substitution. When a developer generates a service named MyCompany.Orders.Api, the Dockerfile's ENTRYPOINT already references the correct assembly name and the docker-compose.yml already maps the correct internal port. This eliminates the container configuration step that otherwise requires developers to manually edit generated files.

The relationship between templates and the broader developer experience platform is evolving rapidly. Microsoft's Dev Containers specification and the devcontainer.json configuration file can be included in a template, ensuring that every generated project has a fully configured VS Code or Codespace environment with the correct .NET SDK version, recommended extensions, and port forwarding rules.

Developers who open the generated project in a Dev Container get a ready-to-run environment in under two minutes, regardless of what is installed on their local machine. This pattern is especially powerful for onboarding new team members or for contractors who need to contribute without the overhead of a full local environment setup.

Monitoring and observability standards embedded in templates pay dividends across the entire service lifecycle. When your template includes OpenTelemetry with pre-configured resource attributes (service.name, service.version, deployment.environment), every service your team generates automatically participates in your distributed tracing infrastructure. The platform team can build Grafana dashboards and alerting rules that work uniformly across all services because the span and metric attribute names are consistent. This is a force multiplier: the template investment compounds in value with each new service that inherits the standard observability configuration.

For teams working with asp net core templates at scale, maintaining a template changelog is as important as maintaining the template itself. When you update the template to upgrade a NuGet package, change a default configuration value, or add a new middleware, document the change with a clear migration note for existing projects.

Developers who generated services six months ago need to know whether they should manually apply the update to their running service. A simple CHANGELOG.md in the template repository, combined with a version bump in the NuGet package, gives teams the information they need to make informed update decisions without guessing what changed.

Practice ASP.NET Core Configuration & Environments Questions

Getting the most out of ASP.NET Core templates in daily development starts with building a personal reference for the flags and parameter combinations you use most often. Keep a team wiki page or a shell alias file that documents your organization's standard dotnet new invocations โ€” the exact command with all flags that generates the canonical starting point for each project type. Developers who internalize these commands stop reaching for GUI wizards and create consistent projects from muscle memory. The ten minutes spent documenting the command pays back on every future project creation.

Explore the dotnet new install ecosystem before building a custom template. The FastEndpoints project ships a template that scaffolds a Vertical Slice Architecture API. The Clean Architecture template from Jason Taylor generates a solution with Domain, Application, Infrastructure, and Web layers fully separated. ABP Framework provides enterprise templates with multi-tenancy, auditing, and modular architecture baked in. Evaluating these templates โ€” even if you ultimately build your own โ€” teaches you patterns for template authoring and exposes architectural ideas you can incorporate into your organization's standard.

Keep your template source in version control alongside the rest of your platform code, not as a one-off artifact. Treat template pull requests with the same rigor as application code: require code review, run automated generation tests, and tag releases semantically. A 1.0.0 template tag should mean developers can reliably install version 1.0.0 of your template and get a project that passes CI. A 1.1.0 tag adds new features without breaking existing generated projects. A 2.0.0 tag signals a breaking change โ€” perhaps a shift from .NET 6 to .NET 8 patterns โ€” that requires a migration guide.

Use dotnet new --update-check and dotnet new --update-apply to keep installed templates current. These commands query the NuGet source for newer versions of all installed template packages and optionally apply updates. In a team environment where templates are distributed via an internal feed, these commands let developers stay synchronized with the platform team's latest standards without needing to remember which version they have installed or check a dashboard. Consider adding dotnet new --update-apply to your team's developer environment setup script so it runs automatically when a developer opens their laptop.

When you encounter a generated file that does not quite match your needs, resist the urge to immediately modify the output. Instead, ask whether the mismatch reflects a missing template parameter, a missing template variant, or a genuine per-project customization. If the same manual change appears in five generated projects, it belongs in the template. If it appears in every project of a certain type, it belongs in a template parameter with a sensible default. Keeping generated code close to the template output reduces drift and makes future template upgrades easier to apply to existing projects.

Testing the generated project immediately after scaffolding โ€” before writing a single line of business logic โ€” is a discipline that saves significant debugging time. Run dotnet build, then dotnet run and verify the application starts without errors. For API projects, open the Swagger UI and confirm the documentation renders. For Blazor projects, navigate to the home route and verify the component renders in the browser. This smoke test takes under two minutes and catches SDK mismatches, missing NuGet restore issues, and port conflicts before they become entangled with your actual application code.

Finally, treat the ASP.NET Core template system as a living standard rather than a one-time configuration. Revisit your organizational templates at each major .NET release โ€” .NET 9, .NET 10 โ€” and evaluate whether new SDK features like enhanced AOT compilation support, new Kestrel configuration options, or updated OpenAPI generation patterns should be incorporated. The teams that maintain disciplined template practices consistently ship new services faster and with fewer early-stage configuration bugs than teams that treat project creation as an afterthought. Templates are technical infrastructure, and investing in them returns value with every project your organization starts.

ASP.NET Core Configuration & Environments 2
Intermediate practice on options pattern, strongly typed config, and environment-specific overrides
ASP.NET Core Configuration & Environments 3
Advanced configuration scenarios including Azure Key Vault, secret rotation, and dynamic reload

Asp Net Core Questions and Answers

What is the difference between the webapi and mvc ASP.NET Core templates?

The webapi template generates a project optimized for JSON APIs with no Razor view engine, no antiforgery token middleware, and OpenAPI documentation enabled by default. The mvc template includes the Razor view engine, tag helpers, Bootstrap, and antiforgery protection for form submissions. Choose webapi when building a backend API consumed by a SPA or mobile app, and mvc when building server-rendered HTML applications.

How do I create a new ASP.NET Core project from a template?

Use the .NET CLI command dotnet new <templateName> -n <ProjectName> -o <OutputFolder>. For example, dotnet new webapi -n MyCompany.Orders.Api -o ./src/Orders creates a Web API project with the correct namespace and output directory. Run dotnet new list first to see all available template short names installed on your machine.

How do I install a third-party or custom ASP.NET Core template?

Run dotnet new install <packageName> where packageName is a NuGet package ID containing a valid template. For community templates, find the package ID on NuGet.org. For internal team templates, configure your NuGet client to point at your internal feed first using dotnet nuget add source, then run the install command with the internal package name.

What does the --auth parameter do in the ASP.NET Core webapi template?

The --auth parameter controls what authentication infrastructure gets scaffolded. --auth Individual generates ASP.NET Core Identity with a SQLite database, user registration, login, and EF Core migrations. --auth IndividualB2C wires Azure AD B2C. --auth Windows configures Windows authentication for intranet apps. Omitting the flag generates a project with no authentication, which you then add manually.

How do I create my own custom ASP.NET Core template for my team?

Build a sample project representing your ideal starting point, then add a .template.config/template.json file at the project root. Define the template's short name, display name, sourceName placeholder, and any custom parameters in the JSON. Package the directory as a NuGet package and push it to your internal feed. Developers install it with dotnet new install and generate projects with the standard dotnet new <yourShortName> command.

Why does my generated project use different patterns than examples I find online?

Template output reflects the .NET SDK version installed on your machine. Projects generated with the .NET 6 SDK use the minimal hosting model with top-level statements. Projects generated with a .NET 8 SDK may include newer default settings for OpenAPI, nullable reference types, and implicit usings. Older tutorials targeting .NET 5 or earlier show a separate Startup.cs file that no longer exists in modern templates. Always check which SDK version the tutorial targets.

What is the purpose of the sourceName field in template.json?

The sourceName field specifies a placeholder string in the template source files โ€” such as MyCompany.Template โ€” that the template engine replaces with the value passed to the -n flag at generation time. This replacement happens in both file names and file contents, automatically setting class namespaces, assembly names, and folder names to match the developer's chosen project name without any manual find-and-replace.

Can I use Blazor Server and Blazor WebAssembly in the same project?

Yes. The blazorwasm --hosted template generates a solution with three projects: a Blazor WebAssembly client, an ASP.NET Core server that hosts the client and provides API endpoints, and a shared class library for models and interfaces. The Blazor 8 unified model (blazor template in .NET 8) goes further by supporting both server-side rendering and interactive WebAssembly rendering from a single project using render mode attributes.

How do I update installed templates to the latest version?

Run dotnet new --update-check to see which installed templates have newer versions available, then run dotnet new --update-apply to install all available updates. For internal templates on a private NuGet feed, ensure your feed credentials are current before running these commands. Templates bundled with the SDK update automatically when you install a new .NET SDK โ€” running dotnet sdk update or installing a new SDK version handles this.

What is the Minimal API template and how does it differ from a controller-based API?

Minimal APIs define HTTP endpoints as inline delegates in Program.cs without controller classes or action attributes. The webapi --minimal flag (or the standalone webapiaot template for AOT compilation) generates this style. Minimal APIs have lower startup overhead and less ceremony for simple services. Controller-based APIs are better organized for large services with many endpoints, and they benefit from a richer ecosystem of action filters, model validation attributes, and third-party tools.
โ–ถ Start Quiz