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.25k stars 9.96k forks source link

The Blazor Web App template in .Net 8 RC2 does not offer equivalent functionality to the previous Blazor hosted WASM template #51281

Closed AlbertoPa closed 3 months ago

AlbertoPa commented 11 months ago

The Blazor Web App template shipped in .Net 8 RC2 does not provide equivalent functionality to the previous Blazor Hosted WASM template: no API is created to retrieve data from the server, leaving the configuration to the user, even if it is necessary in nearly any non-trivial application. The consequence of this is that no auth for the API is set up either, requiring a significant amount of work to just get started with a basic app with some form of auth. The scenario is also not currently documented.

In issue #49798 it was said that the hosted WASM template would have still been available, however, the RC2 release ( https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-rc-2/#blazor ) indicates to use the "Blazor Web App" template with "WebAssemly" interactivity mode. This does not lead to an equivalent configuration to the previous "Hosted Blazor WebAssembly" application.

Also, what discussed in issue #50433 (root level interactivity) addresses what requested in issue #49798 only in part.

I suggest adding an option generating an app with a configuration closer to what the Hosted Blazor WebAssembly used to offer.

marinasundstrom commented 11 months ago

Perhaps an option for generating sample controller and OpenAPI in combination with Interactive WebAssembly? With WeatherForecast being generated in the Client project.

Just wonder how complex the template will be, if to include it in the new Blazor app template.

AlbertoPa commented 11 months ago

That would work, but I don't know about the complexity of the template with that addition.

codemonkeh-dave commented 11 months ago

I too am keen to see API controllers in the template with a client fetch example (especially the authenticated scenario). None of the new templates appear to create the typical WeatherForecastController example that we get in the .Net 7 templates and I have spent a number of hours trying to get it working to no avail.

I should be able to use cookie auth on both server side pages and api calls with the same authorize attribute.

If anyone knows of any examples ^^, it would be greatly appreciated! I genuinely love the new features coming and as a C# developer can move away from React front-end to something that has been designed with ease-of-use and good consideration for modern SSR and hybrid (stream rendering) scenarios. Keep up the great work @danroth27 and team!

Stamo-Gochev commented 11 months ago

@danroth27 Can you add the necessary changes to the sample project that you have started in https://github.com/danroth27/Net8BlazorWebAssembly/#blazor-webassembly-in-net-8, so that the Blazor Wasm Hosted app is updated to .NET 8.0?

I see that you have done that on Oct 26, 2023 for the Blazor Server project in https://github.com/danroth27/Net8BlazorServer/commit/b880f6e7a175b483918f6c77a754e7a99b46f4dc, but it will be helpful to me to see the equivalent update for Blazor Wasm Hosted app in https://github.com/danroth27/Net8BlazorWebAssembly/#blazor-webassembly-in-net-8.

I am in the process of updating Blazor Wasm apps that target .NET 6 and 7 and the new .NET 8.0 default template is rather different, so having this before the official release of .NET 8.0 will be highly appreciated.

AlbertoPa commented 10 months ago

This scenario is still missing in the final .Net 8 templates, and there is no documentation for hosted Blazor WASM apps concerning the use of Microsoft Identity Platform (only available for standalone WASM, no coverage for hosted WASM nor Auto mode).

Laftek commented 4 months ago

any updates?

martinRocks commented 3 months ago

any updates on this? I really want the 3 project template back. The current project template 'Blazor Web App' doesn't create a web assembly that hits the web api.

danroth27 commented 3 months ago

This work is now being tracked by https://github.com/dotnet/aspnetcore/issues/55307. See the discussion there for the latest status.