7
votes

I'm trying to figure out how dotnet core is working and therefore creating some projects to play around with it. I found a guide where they said, that i should run "dotnet new -t web" to create a more fully-featured web application. But when i do, it just says:

Invalid input switch:
  -t 

Template Instantiation Commands for .NET Core CLI.

Usage: dotnet new [arguments] [options]

Arguments:
  template  The template to instantiate.

Have they changed it? And why doesn't any documents appear when i run "dotnet new", but only if i do "dotnet new mvc" or "dotnet new web". I'm using Visual Studio Code.

Thanks in advance.

2

2 Answers

8
votes

Yes, they changed the CLI tool as part of the move from project.json back to csproj. More info on the official documents.

The best source is the up to date documentation for dotnet new:

Creates a new project, configuration file or solution based on the specified template.

dotnet new <TEMPLATE> [-lang|--language] [-n|--name] [-o|--output] [-all|--show-all] [-h|--help] [Template arguments]
dotnet new <TEMPLATE> [-l|--list]
dotnet new [-all|--show-all]
dotnet new [-h|--help]

Examples:

dotnet new mvc                   ==> New C# MVC app
dotnet new console -lang f#      ==> New F# console app
0
votes

Looks like the guide that you're following was referencing the previous version of dotnet core cli. In previous versions -t was required to specify the template. Now it works differently.

According to documentation you can use command new in one of the following ways:

dotnet new <TEMPLATE> [-lang|--language] [-n|--name] [-o|--output] [-all|--show-all] [-h|--help] [Template arguments]
dotnet new <TEMPLATE> [-l|--list]
dotnet new [-all|--show-all]
dotnet new [-h|--help]

However, even when you call dotnet new it should show some information (checked in VS Code and command line).

Hope that will help.