-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Consider restoring the Blazor WebAssembly "hosted" option #49798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We're going to bring back the hosted option with an additional log message suggesting that the new template should be preferred in case of it meets all the requirements the developer has. |
Currently the new "Blazor Web App" template does not offer the option to configure a Web API that can be called from WebAssembly. What is the guidance for a WASM app based on the new template to interface, for example, to a database in simple scenarios where there is no clear need for a separate Web API app? It is a common scenario for a client-side app. |
Closing this in favor of #50433 |
Well this sucks. Closing this in favor of #50433 ignores all the reasons expressed above to have a hosted template. Doubling down on "interactive" components doesn't solve the issues this ticket was opened for. |
I don't know your scenario exactly, but just to clarify, the approach we've taken doesn't ignore the points raised above. It accounts for scenario 1 (WebAssembly-everywhere projects) completely. It doesn't deal with scenario 2 (PWAs) so yes you would have to add the |
Steve - I sincerely appreciate your reply here. In your comment opening this issue you said "If you want a WebAssembly-everywhere project, like we offered in .NET 7 and earlier, it would be really hard to set that up without a template for it." We do law enforcement applications and require offline capabilities because troopers/officers travel around and have spotty Internet service. In one case we've gone with .NET MAUI Blazor Hybrid for an installable client, but in several other cases we use Blazor WASM. I've been excited for Blazor as it's prevented us from having to go with React\Angular\Vue for SPA applications. The hosted solution was perfect for creating a Blazor WebAssembly SPA, since it included the API, set everything up to work against it, had the shared project and we could build/deploy the API and SPA together. Maybe I'm not catching on yet, but it feels like WASM is being looked at now to just targeting a few "interactive" components in basically a Blazor Server app instead of it acting as a SPA on its own. I have teams for 17 states, and we have stayed away from Blazor Server due to the connectivity requirements in all but a small intranet criminal history application. WebAssembly in the hosted model was perfect for us (aside from it lacking in the auth dept). I have searched and been unable to find anything about things like:
Also, since you might see this reply - hot reload is completely broken in Visual Studio 2022 Preview 17.8 Preview 2 for solutions created using the hosted template. Works fine for projects created using the new Blazor Web App template, just not for any of our solutions based on I opened up a ticket on the Visual Studio Dev Community Site with a sample project and reproduction steps. |
You won't find any docs about this yet because they are only produced as part of the final 8.0 updates.
If you enable global interactivity, it's just like the "Blazor WebAssembly hosted in ASP.NET Core" option from 7.0 and earlier. So you add WebAPIs to your server project just like before.
If you enable global interactivity with WebAssembly, all your components are running on WebAssembly just like before. |
DR and I just placed some coverage on this subject. Note that product unit engineers might not have seen it yet. We'll have a major docs review before RTM (I hope 🤞🍀😄). The Call web API guidance has been updated (i.e., language updates) for 8.0. The main scenarios are no different than what we had before ... Migration guidance for hosted WASM via the WASM template of 7.0 to hosted WASM via the BWA template of 8.0 (including PWA) is forthcoming. There's still too much framework churn right now for me to write up migration guidance. I'll reach it after RC2 comes out in a few weeks. |
Is global interactivity supposed to work in RC1 for WebAssembly?
The error is: This is in a new Blazor Web App project with the only change made being adding the rendermode as indicated in the code. I apologize if this is an error that should be reported elsewhere, it just seemed germane to the discussion here. |
Sorry - that seemed to be a response to a message I added and deleted after finding that link. I tried it and got the error I mentioned before your comment. |
@revbones-dev ... If it isn't working, please open a new issue with all of the details. The team doesn't work on closed issues/PRs. |
Will do - I just wasn't sure if I was on the right track. Seems like I was and it's just broken in RC1. I appreciate both your and Steve's responses. |
Uh oh!
There was an error while loading. Please reload this page.
We recently removed the
--hosted
option from the Blazor WebAssembly project template, on the grounds that we considered it unnecessary now that the newblazor
template includes support for WebAssembly components on an ASP.NET Core host.However, there are still clear use cases for
dotnet new blazorwasm --hosted
:dotnet new blazor --use-wasm
, then make lots of changes to move files into the WebAssembly project.--pwa
option on the Blazor Web project, because it couldn't work offline by default (we can't cache all the SSR pages, we don't even have a way to discover them all). If our PWA is to continue meaning "offline-enabled PWA", then that will only be able to work in a WebAssembly-everywhere case, and so we need to use theblazorwasm
template for that. If someone wants to combine this with being ASP.NET Core-hosted, they will needblazorwasm --hosted
to be brought back.The text was updated successfully, but these errors were encountered: