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.

"dotnet new -l" only displays 1 template when there should be 2

See original GitHub issue

Hi.

I have 2 project templates (one creates a project that produces a project template, and the other produces a project that produces an item template). Their identity fields (in template.json) are different.

Oddly, only 1 of them shows up when running dotnet new -l (usually the last one I installed) but never both. I’m not quite sure what the problem is here, but let me demonstrate:

I’ve tried this by either installing from a package (dotnet new -i FiftyProtons.Templates.DotNetNew::0.1-alpha3) or installing from a folder (dotnet new -i src/Templates/content/ProjectTemplate && dotnet new -i src/Templates/content/ItemTemplate):

➜  TemplateDemo: dotnet new -l
Template Instantiation Commands for .NET Core CLI.

Usage: dotnet new [arguments] [options]

Arguments:
  template  The template to instantiate.

Options:
  -l|--list         List templates containing the specified name.
  -lang|--language  Specifies the language of the template to create
  -n|--name         The name for the output being created. If no name is specified, the name of the current directory is used.
  -o|--output       Location to place the generated output.
  -h|--help         Displays help for this command.
  -all|--show-all   Shows all templates


Templates                 Short Name         Language        Tags                 
----------------------------------------------------------------------------------
Console Application       console            [C#], F#        Common/Console       
Class library             classlib           [C#], F#        Common/Library       
Item template             item-template      [C#], [C#]      Common/Templates/Item
Unit Test Project         mstest             [C#], F#        Test/MSTest          
xUnit Test Project        xunit              [C#], F#        Test/xUnit           
ASP.NET Core Empty        web                [C#]            Web/Empty            
ASP.NET Core Web App      mvc                [C#], F#        Web/MVC              
ASP.NET Core Web API      webapi             [C#]            Web/WebAPI           
Solution File             sln                                Solution             

Although project-template is present, and can be invoked by name, it’s not shown in the list.

➜  TemplateDemo: dotnet new project-template
Content generation time: 41.4391 ms
The template "Project template" created successfully.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mlorbetskecommented, Mar 20, 2017

Yep, exactly right

0reactions
tintoycommented, Mar 20, 2017

Thanks for your help 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet new console --framework netcoreapp1.0 produces ...
x templates into the 2.0 CLI) that end up adding to one of the options that originally had only one value, it'll get...
Read more >
NET default templates for dotnet new - .NET CLI
The following table shows the templates that come pre-installed with the .NET SDK. The default language for the template is shown inside the ......
Read more >
Unable to determine the desired template from the input ...
Good news, it is easy to fix. Step 1: remove wrong templates: dotnet new -u Microsoft.AspNetCore.Blazor.Templates. Step 2: install ...
Read more >
Trying out "dotnet new" template updates and csproj with ...
You just run "Visual Studio Installer" if you've already got a version installed and it updates. The updating processes reminds me a little...
Read more >
How to build a .NET template and use it within Visual Studio ...
Templates package will contain 2 solution templates and 1 project template. ... The shortName appears when you run dotnet new -l and it...
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