Search code examples
blazorblazor-client-side

WebAssemblyUriHelper missing in Blazor Preview 9


I have been using Microsoft.AspNetCore.Blazor.Services.WebAssemblyUriHelper to get the base URI in my app

With the upgrade to Preview 9 the Microsoft.AspNetCore.Blazor.Services appears to have been removed

What is the best way with preview 9 to get the base Uri?

Thanks


Solution

  • In your components you should use

    @inject NavigationManager navigationManager
    

    where do you previously using IUrlNavigationManager. Not sure why do you need to use WebAssemblyUriHelper directly.

    Where you previously has call to method uriHelper.GetBaseUrl() you right now has property invocation navigationManager.BaseUrl.