The dotnet cli has template support to generate projects. But visual studio has its own template project system and does not use the dotnet templates, but rather its own. There is overlap but they don’t need to match.
Blazor isn't listed in Visual Studio Community 2022
Hello
I'm trying to start a new Blazor WebAssembly App in Visual studio 2022 but it isn't listed there.
I did run dotnet new --list in the command line and it shows both Blazor WebAssembly App and Blazor Server App listed so I'm not sure why it isn't available from the New Project list in VS.
I installed .NET SDK 8.0 and also most of ASP.NET and Web Development tools but still not listed.
Is there anything I might be missing to have it listed? I know I can run a new template install for Blazor via CLI but I don't want to do that, it's preferable to choose he project within VS
Blazor
Visual Studio
-
AgaveJoe • 29,676 Reputation points
2025-01-19T16:20:09.25+00:00 If I recall correctly Blazor WebAssembly and Blazor Server ended with the release of Core 8. Now it's called "Blazor WebAssembly Standalone App" or you pick "Blazor Web App" and select the WebAssembly interactive render mode when prompted to select a render mode.
Also, dotnet new --list is deprecated. The latest command is dotnet new list.
I'm guessing you have .NET 6 (or 7) installed which is why you can see the Blazor WebAssembly in the list.
If you cannot see Blazor anywhere in Visual Studio then you probably need to install the ASP.NET and web development workload. Run the Visual Studio Installer.
-
FabioM • 0 Reputation points
2025-01-19T16:29:12.5966667+00:00 @AgaveJoe I have .NET 8 installed and I did installed most of the tools from the ASP.NET and Web Development tools workload.
I should have mentioned the correct template names in my question. Here they are:
Blazor Server App blazorserver [C#] Web/Blazor
Blazor Web App blazor [C#] Web/Blazor/WebAssembly
Blazor WebAssembly Standalone App blazorwasm [C#] Web/Blazor/WebAssembly/PWA
So why aren't these listed in Visual Studio but only when I execute dotnet new list?
-
r21d • 0 Reputation points
2025-01-19T18:23:20.7233333+00:00 Check your installed envs in VS, i've got one "Start Experimental Instance of Visual Studio 2022 (2)".. So the second iteration of an experimental, this is due to prerelease .net9 thingies, so if one has installed the c#fullstack pack on an experimental, OR maybe you had either of the real visual studios in the mix, all look the same superficially.
The nomenclature is weirdish, the blazor standalone is wasm, where the other 2 are essentially serverfull; But the build manifest in one targets wasm, and .net backend on the other.
But yea, install Visual Studio Professional, and target only the forementioned. Do a square one snapshot of a VM, and use eval/dev builds.
-
Carlos Enrique Canales L�pez • 0 Reputation points
2025-01-20T16:53:46.4633333+00:00 @AgaveJoe in my case I do have a question related to this topic because I want to start a project with the Blazpr WebAssembly App template but it is no longer only those two that you mention.
according to a video it should look like this:
I would like to know if the way I have it is the same or similar:
and the result of the video after finishing it looks like this with the file explorer but I get it without the .Shared section at the end :
-
FabioM • 0 Reputation points
2025-01-20T19:30:54.2+00:00 1- And another confusing thing, is that I'm able to choose Blazor Web App and Blazor WebAssembly Standalone app in Jetbrains Rider.
I've lost countless hours trying to have the setup seamless correct in Visual Studio but something is off.
2- Also, I opened a recent project C# project in VS and every action I did in the IDE prompted the VS Installer.
3- I removed previous .NET Core and runtime versions I had (3.1.32 and Core 3.0 versions) and now only have .NET Core 8 installed
-
AgaveJoe • 29,676 Reputation points
2025-01-20T19:59:34.46+00:00 If I understand correctly, you are looking for the .NET 7.0 Hosted Blazor WebAssembly template. The command to create a hosted Blazor WebAssembly for .NET 7.0 is...
dotnet new blazorwasm -f net7.0 -ho
This assumes you have the .NET 7.0 SDK installed.
https://dotnet.microsoft.com/en-us/download/dotnet/7.0
Keep in mind, .NET 7 is no longer supported. The following document illustrates the templates in the SDKs and when the template started.
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-new-sdk-templates
-
FabioM • 0 Reputation points
2025-01-20T21:23:28.4566667+00:00 I have .NET 8.0.405 installed.
I can create Blazor projects from the command line but would like to have them available in Visual Studio too.
-
AgaveJoe • 29,676 Reputation points
2025-01-20T22:44:47.7766667+00:00 I have .NET 8.0.405 installed.
The Hosted Blazor WebAssembly template you are looking for does not exist in .NET 8 because the project and framework are no longer supported. The template exists in .NET 7.0 and 6.0 SDKs though.
I can create Blazor projects from the command line but would like to have them available in Visual Studio too.
In my opinion, the simplest solution is to install SDK 7 and use the command line to generate the deprecated projects that target a unsupported framework version.
You could go back to an earlier version of Visual Studio, a version before .NET 8. But that seems counter productive.
Another option is to add a global.json file to the root of your project that targets 7.
https://learn.microsoft.com/en-us/dotnet/core/tools/global-json
{ "sdk": { "version": "7.0.410" } }
Of course you must have Installed SDK 7. When I did this I was able to pick the Blazor WebAssembly Empty App project. From there I had the Hosted option which generated the three projects; server, client, and shared.
-
FabioM • 0 Reputation points
2025-01-21T19:17:24.0233333+00:00 It's a bit confusing you mentioning that the Blazor templates are only available in .NET 7.
Here's a screencast showing how I'm able to create a Blazor Web App with .NET 8 in Rider, but not in VS: https://www.screenpresso.com/=IIjirTe7Po4i
-
FabioM • 0 Reputation points
2025-01-21T19:19:37.8733333+00:00 Removed duplicate
-
AgaveJoe • 29,676 Reputation points
2025-01-21T23:37:44.67+00:00 It's a bit confusing you mentioning that the Blazor templates are only available in .NET 7.
I said the template (see your screenshot) ended with Visual Studio .NET 8. SDK 7 is the last SDK that has the template.
Here's a screencast showing how I'm able to create a Blazor Web App with .NET 8 in Rider, but not in VS:
I don't see Blazor mentioned anywhere in your Rider screenshot.
-
FabioM • 0 Reputation points
2025-01-22T14:36:12.73+00:00 Blazor is there around the 15th second on the video.
Sign in to comment
1 answer
Sort by: Most helpful
-
Bruce (SqlWork.com) • 70,216 Reputation points
2025-01-19T17:27:54.2066667+00:00 -
FabioM • 0 Reputation points
2025-01-20T15:23:13.19+00:00 That's weird.
I went on to check JetBrains RIder which I use to and both Blazor templates are listed there but not in VS.
-
Bruce (SqlWork.com) • 70,216 Reputation points
2025-01-21T20:48:31.8533333+00:00 like many SPA frameworks Blazor is focusing on server pre-render. so the default template has a hosting server project and a client project. part of the template wizard is to pick server or wasm.
Sign in to comment -