How to create Blazor webassembly and server apps in visual studio code

Painful memories of ActiveX controls, java applets, Silverlight, Flash and the other attempts at portable code are all being revenged by WebAssembly. I don't care how good someone is at JavaScript. They will make more mistakes (especially subtle, hard-to-find bugs) in JavaScript than they would doing the same task in C#. Every time. Blazor with WebAssembly is mature now to the point of being very useful. The great thing about WebAssembly is that it is a standard, unlike ActiveX or Silverlight.

 Here are the steps to create either a Blazor WebAssembly or a Blazor Server app in Visual Studio Code:

From a command shell:

dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.2.0-preview1.20073.1

1. Install Visual Studio Code, if not already installed.
2. Install the latest C# for Visual Studio Code extension.
3. For a Blazor WebAssembly experience, execute the following command in a command shell:

dotnet new blazorwasm -o WebApplication1

You can do the above from a command shell at the C:\ location. WebApplication1 will be the name of the project folder created.

For a Blazor Server experience, execute the following command in a command shell:

dotnet new blazorserver -o WebApplication1

 Open the WebApplication1 folder in Visual Studio Code.

For a Blazor Server project, the IDE requests that you add assets to build and debug the project. Select Yes.

If using a Blazor Server app, run the app using the Visual Studio Code debugger. If using a Blazor WebAssembly app, execute dotnet run from the app's project folder.

In a browser, navigate to https://localhost:5001.

That's it. From here you can add services, model classes, and custom assets. The "Stock" Project that is created with the above will have several features that you can examine to get off to a good start.



Comments

Popular posts from this blog

Some observations on Script Callbacks, "AJAX", "ATLAS" "AHAB" and where it's all going.

IE7 - Vista: "Internet Explorer has stopped Working"

FIREFOX / IE Word-Wrap, Word-Break, TABLES FIX

System.Web.Caching.Cache, HttpRuntime.Cache, and IIS Recycles

FIX: Requested Registry Access is not allowed (Visual Studio 2008)