question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing "No templates found matching:..."-message when using `-minimal` option with `dotnet new`

See original GitHub issue

Describe the bug

When using dotnet new with the -minimal option, no “No templates found matching:…”-message is shown to the user, if no matching template exists. Instead a generic “For more information, run:…”-message is shown.

To Reproduce

The issue can be reproduced by running dotnet new with the -minimal option, and a combination of template and language that doesn’t exist. The example below uses the webapi template with -lang option “F#”, since no minimal webapi-template exists for F#:

$> dotnet new webapi -minimal -o TodoApi -lang F#
For more information, run:
   dotnet new webapi -h

I was expecting to see a “No templates found matching:…”-message, informing me that no F#-version of this template exists, but was instead shown a “For more information…”-message.

Expected behavior

To illustrate the expected behavior, I’m including an example of trying to create a new project without the -minimal option, using the grpc template with -lang option “F#”, another combination for which no template exists:

$> dotnet new grpc -o TodoApi -lang F#
No templates found matching: 'grpc', language='F#'.

To list installed templates, run:
   dotnet new --list
To search for the templates on NuGet.org, run:
   dotnet new grpc --search

As expected, a “No templates found matching:…”-message is printed to the console, and I would expect the behavior of dotnet new to be similar to this when using the -minimal option.

Further technical details

I’m using Ubuntu 20.04.3 LTS (64-bit version), and running the dotnet command straight from the default terminal (gnome-terminal).

The output from dotnet --info is as follows:

$> dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.101
 Commit:    ef49f6213a

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.101/

Host (useful for support):
  Version: 6.0.1
  Commit:  3a25a7f1cc

.NET SDKs installed:
  3.1.416 [/usr/share/dotnet/sdk]
  5.0.404 [/usr/share/dotnet/sdk]
  6.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.22 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.22 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Background

Discovered this bug following the Microsoft Tutorial: Create a minimal web API with ASP.NET Core. This tutorial also introduced me to the -minimal option in .NET CLI.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vlada-shubinacommented, Oct 3, 2022

Closing. Please follow https://github.com/dotnet/aspnetcore/issues/40161 for ASP.NET template update.

1reaction
vlada-shubinacommented, Sep 26, 2022

This was fixed in dotnet new, removing the label

Read more comments on GitHub >

github_iconTop Results From Across the Web

No templates found matching: 'HttpTrigger'
To list installed templates, run 'dotnet new --list'. To search for the templates on NuGet.org, run 'dotnet new HttpTrigger --search'.
Read more >
Custom templates for dotnet new - .NET CLI
Learn about custom templates for any type of .NET project or files.
Read more >
dotnet new templates for Uno Platform
If you tried to use the templates with a version different than the one you used for installing, you'll get "No templates found...
Read more >
How to install and use a project template using dotnet CLI
Unzip the .zip. then in your terminal, navigate to the template folder (it should contain a folder named .template.config ). Then run dotnet...
Read more >
dotnet new <TEMPLATE> - .NET CLI
The dotnet new command creates new .NET projects based on the specified template.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found