dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.37k stars 9.99k forks source link

VS2019 Blazor templates not available #7642

Closed RobSeder closed 5 years ago

RobSeder commented 5 years ago

Describe the bug

Following the instructions from here: https://docs.microsoft.com/en-us/aspnet/core/client-side/spa/blazor/get-started?view=aspnetcore-3.0&tabs=visual-studio using Windows 10 Pro (Version 10.0.17763.316) and VS2019 (Version 16.0.0 Preview 3.0) on 64-bit. From a VS2019 Developer Command Prompt, I run:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates

then, start a fresh instance of VS2019 and choose New ASP.NET Core Web Application, I see several templates, but nothing for Blazor.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core 3.0.100-preview-010184, Windows 10 Pro 10.0.17763.316 and VS2019 Preview (Version 16.0.0 Preview 3.0)
  2. From the VS2019 Developer Command Prompt, run this code dotnet new -i Microsoft.AspNetCore.Blazor.Templates
  3. Launch VS2019, choose Create New Project -> ASP.NET Core Web Application -> click Create -> Choose "ASP.NET Core 3.0" and ".NET Core" from dropdowns at the top.
  4. Do not see any Blazor templates available.

Expected behavior

Expected to see a Blazor template available.

Additional context

Uutput of dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview-010184
 Commit:    c57bde4593

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview-010184\

Host (useful for support):
  Version: 3.0.0-preview-27324-5
  Commit:  63a01b08e5

.NET Core SDKs installed:
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.500 [C:\Program Files\dotnet\sdk]
  2.1.502 [C:\Program Files\dotnet\sdk]
  2.1.504 [C:\Program Files\dotnet\sdk]
  2.1.600-preview-009426 [C:\Program Files\dotnet\sdk]
  2.1.600-preview-009497 [C:\Program Files\dotnet\sdk]
  3.0.100-preview-010184 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview-19075-0444 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview-27324-5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview-27325-3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
Andrzej-W commented 5 years ago

This command

dotnet new -i Microsoft.AspNetCore.Blazor.Templates

is required if you want to use Blazor templates from command line. To see Blazor templates in VS you have to install Blazor Language Services. This is step number 1 in the doc: https://docs.microsoft.com/en-us/aspnet/core/client-side/spa/blazor/get-started?view=aspnetcore-3.0&tabs=visual-studio

RobSeder commented 5 years ago

@Andrzej-W Thanks! I didn't catch that. I agree, after installing the extension the VS2019 side works as described.

Also though, that command:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates

That seems to do something, but also returns the "usage" help screen as if an incorrect variable was passed. FYI

  Restoring packages for C:\Users\RobSe\.templateengine\dotnetcli\v3.0.100-preview-010184\scratch\restore.csproj...
  Installing Microsoft.AspNetCore.Blazor.Templates 0.7.0.
  Generating MSBuild file C:\Users\RobSe\.templateengine\dotnetcli\v3.0.100-preview-010184\scratch\obj\restore.csproj.nuget.g.props.
  Generating MSBuild file C:\Users\RobSe\.templateengine\dotnetcli\v3.0.100-preview-010184\scratch\obj\restore.csproj.nuget.g.targets.
  Restore completed in 3.32 sec for C:\Users\RobSe\.templateengine\dotnetcli\v3.0.100-preview-010184\scratch\restore.csproj.

Usage: new [options]

Options:
  -h, --help          Displays help for this command.
  -l, --list          Lists templates containing the specified name. If no name is specified, lists all templates.
  -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.
  -i, --install       Installs a source or a template pack.
  -u, --uninstall     Uninstalls a source or a template pack.
  --nuget-source      Specifies a NuGet source to use during install.
  --type              Filters templates based on available types. Predefined values are "project", "item" or "other".
  --dry-run           Displays a summary of what would happen if the given command line were run if it would result in a template creation.
  --force             Forces content to be generated even if it would change existing files.
  -lang, --language   Filters templates based on language and specifies the language of the template to create.

Templates                                         Short Name            Language          Tags                          
-------------------------------------------------------------------------------------------------------------------------------
Console Application                               console               [C#], F#, VB      Common/Console                
Class library                                     classlib              [C#], F#, VB      Common/Library                
WPF Application                                   wpf                   [C#]              Common/WPF                    
Windows Forms Application                         winforms              [C#]              Common/WinForms               
Unit Test Project                                 mstest                [C#], F#, VB      Test/MSTest                   
NUnit 3 Test Project                              nunit                 [C#], F#, VB      Test/NUnit                    
NUnit 3 Test Item                                 nunit-test            [C#], F#, VB      Test/NUnit                    
xUnit Test Project                                xunit                 [C#], F#, VB      Test/xUnit                    
Razor Page                                        page                  [C#]              Web/ASP.NET                   
MVC ViewImports                                   viewimports           [C#]              Web/ASP.NET                   
MVC ViewStart                                     viewstart             [C#]              Web/ASP.NET                   
Blazor (hosted in ASP.NET server)                 blazorhosted          [C#]              Web/Blazor/Hosted             
Blazor Library                                    blazorlib             [C#]              Web/Blazor/Library            
Blazor (Server-side in ASP.NET Core)              blazorserverside      [C#]              Web/Blazor/ServerSide         
Blazor (standalone)                               blazor                [C#]              Web/Blazor/Standalone         
ASP.NET Core Empty                                web                   [C#], F#          Web/Empty                     
ASP.NET Core Web App (Model-View-Controller)      mvc                   [C#], F#          Web/MVC                       
ASP.NET Core Web App                              webapp                [C#]              Web/MVC/Razor Pages           
ASP.NET Core with Angular                         angular               [C#]              Web/MVC/SPA                   
ASP.NET Core with React.js                        react                 [C#]              Web/MVC/SPA                   
ASP.NET Core with React.js and Redux              reactredux            [C#]              Web/MVC/SPA                   
Razor Class Library                               razorclasslib         [C#]              Web/Razor/Library/Razor Class Library
ASP.NET Core Web App (Razor Components)           razorcomponents       [C#]              Web/RazorComponents           
ASP.NET Core Web API                              webapi                [C#], F#          Web/WebAPI                    
global.json file                                  globaljson                              Config                        
NuGet Config                                      nugetconfig                             Config                        
Dotnet local tool manifest file                   tool-manifest                           Config                        
Web Config                                        webconfig                               Config                        
Solution File                                     sln                                     Solution                      

Examples:
    dotnet new mvc --auth Individual
    dotnet new web
    dotnet new --help
carlosrfernandez commented 5 years ago

@RobSeder after running the initial command, you can then run dotnet new blazorserverside (for example)

The project opens just fine in VS2019. Is this not the behavior you want?

RobSeder commented 5 years ago

@carlosrfernandez As noted above, it also produces a "usage" screen which makes it look like something was entered incorrectly.

mkArtakMSFT commented 5 years ago

Thanks for your help, @Andrzej-W