Reputation: 95
I am a beginner of Blazor. I want to create a "Blazor App" project according to the tutorial: [![The project template in the tutorial][1]][1]: https://i.sstatic.net/vnq8u.png
But I can't find the "Blazor App" in my visual studio. My Visual Studio have "Blazor Server App" and "Blazor WebAssembly App" project templates, but there is no "Blazor App" project template: [![The project template in my Visual Studio][2]][2]: https://i.sstatic.net/Qhdik.png
The version of my visual studio 2019 is 16.9.6. How can I install the "Blazor App" project template?
Upvotes: 3
Views: 4377
Reputation: 52508
Have 3 solutions.
1. Use command line
dotnet new blazorwasm
dotnet new blazorserver
See help document, type
dotnet new blazorwasm -h
dotnet new blazorserver -h
2. Uninstall and install Visual studio
3. Install project template for Visual Studio 2019, even you can try Visual Studio 2019 preview.
dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.1
https://www.nuget.org/packages/Microsoft.AspNetCore.Components.WebAssembly.Templates/
then everything will ok
Upvotes: 0
Reputation: 74605
You're just following a tutorial where the choice of which kind of Blazor app to make was made on a later screen
Decide which kind of app you want to make:
Server - the server runs the c# code and delivers small fragments of HTML to the browser over a websockets connection, and the browser patches its display to make it look like things are happening. It starts up quickly and is good for keeping things like connection strings that the code uses as a secret because they never leave the server. It is more difficult to scale to thousands of users because effectively the server runs the app and the users "use it remotely" but the server has to remember state for all of them and load balancing across multiple servers is tricky. Microsoft claim good performance for thousands of concurrent users on even quite low spec Azure web apps (3.5g ram) but I'm sure the test app that supported th claims wasn't the most complex app in the world ;)
WebAsm - the server sends a small version of .Net engine and your code, to the browser which then runs all your c# code in the browser and generates html locally that is used to patch the display and make changes. It is slower to start because a lot of data has to be downloaded(but some of it can then be cached) and if there are things you want to keep secret (let's say you invent an awesome new algorithm for something, be aware that if you do it in the c# that is sent to the browser to run, it could also be captured and decompiled) then you need to be careful to have them done by an api on the server that you have the client side app call (just like you would with a typical api+Json+javascript app), but it can scale more easily because the server has much less work to do overall. WebAsm apps can also (do long as they don't rely on the server for everything) potentially carry on working if three is no network connection. A server app stops because essentially the browser is only "a VNC" or "Remote Desktop" to an app that runs on the server and ships html back and forth
Upvotes: 3