Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
143 lines (94 sloc) 6.6 KB
title subtitle
Upgrade guide
How to update a project for newer releases

From v0.8 to v0.9

Bolero 0.9 upgrades the dependency on .NET Core to 3.0 RTM and on Blazor to 3.0-preview9. It doesn't include any breaking changes. Here are the associated upgrade steps:

From v0.7 to v0.8

Bolero 0.8 upgrades the dependency on Blazor and .NET Core to 3.0-preview8. Here are the associated upgrade steps:

  • Install the .NET Core 3.0-preview8 SDK.

  • The server-side module Remote has been removed, with its functions withHttpContext, authorize and authorizeWith.

    Instead, a new type IRemoteContext is provided via dependency injection:

    type IRemoteContext =
        inherit IHttpContextAccessor // member HttpContext : HttpContext with get, set
        member Authorize : ('req -> Async<'resp>) -> ('req -> Async<'resp>)
        member AuthorizeWith : seq<IAuthorizeData> -> ('req -> Async<'resp>) -> ('req -> Async<'resp>)

    To obtain this new value:

    • If you use a RemoteHandler class with dependency injection, simply take ctx: IRemoteContext as additional argument in its constructor.

    • If you use a plain record value, make it instead a function that takes ctx: IRemoteContext as argument and returns the record. New overloads on IServiceCollection.AddRemoting can take such a function as argument.

    Then, to use it:

    • Replace Remote.withContext <| fun http arg -> // ... with a simple fun arg -> ....

    • Replace Remote.authorize <| fun http arg -> // ... with ctx.Authorize <| fun arg -> ....

    • Replace Remote.authorizeWith attrs <| fun http arg -> // ... with ctx.AuthorizeWith attrs <| fun arg -> ....

    In all three cases, use ctx.HttpContext instead of http in the function.

From v0.6 to v0.7

Bolero 0.7 updates the dependency on Blazor and .NET Core to 3.0-preview7. Here are the associated upgrade steps:

  • Install the .NET Core 3.0-preview7 SDK.

  • Cmd.ofRemote, Cmd.performRemote and the related type RemoteResponse<'T> are obsolete. Here is how to update:

    • If the remote call is to a non-authorized function, then simply use Cmd.ofAsync / Cmd.performAsync.

    • If the remote call is to an authorized function, then replace RemoteResponse<'T> with option<'T>, Cmd.ofRemote with Cmd.ofAuthorized and Cmd.performRemote with Cmd.performAuthorized.

From v0.5 to v0.6

Bolero 0.6 updates the dependency on Blazor and .NET Core to 3.0-preview6. Here are the associated upgrade steps:

  • Install the .NET Core 3.0-preview6 SDK.

  • The server-side Startup.fs code has changed. In Configure, the method UseBlazor has been removed; replace it with the following:

        .UseEndpoints(fun endpoints ->
            endpoints.MapDefaultControllerRoute() |> ignore
            endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html") |> ignore)

    This requires the addition of the following line in ConfigureServices:

        services.AddMvcCore() |> ignore

HTML hot reloading also received changes.

  • A new NuGet package Bolero.HotReload.Server needs to be referenced by the Server project.

  • IAppBuilder.UseHotReload is deprecated; instead, add endpoints.UseHotReload() at the top of the UseEndPoints callback:

        .UseEndpoints(fun endpoints ->
            endpoints.MapDefaultControllerRoute() |> ignore
            endpoints.MapFallbackToClientSideBlazor<Client.Startup>("index.html") |> ignore)

From v0.4 to v0.5

Blazor 3.0

Bolero 0.5 doesn't bring any breaking API changes. However, it upgrades the dependency on Blazor from 0.7 to 3.0-preview5; and by doing so, it also upgrades the dependency on .NET Core from 2.1 to 3.0-preview5. This brings a number of necessary changes to projects. Here are the necessary steps:

  • Install the .NET Core 3.0-preview5 SDK.

  • If your solution contains a global.json file with an explicit SDK version, either remove the file or update its SDK version to 3.0.100-preview5.

  • In paket.dependencies:

    • In the framework declaration, replace netcoreapp2.1 with netcoreapp3.0.
    • Remove the following nuget lines:
      • Microsoft.AspNetCore.App (In ASP.NET Core 3.0, it is automatically included by the SDK)
      • Microsoft.AspNetCore.Razor.Design
      • Microsoft.AspNetCore.SignalR
    • Replace clitool Microsoft.AspNetCore.Blazor.Cli with nuget Microsoft.AspNetCore.Blazor.DevServer.
    • For all the Microsoft.AspNetCore.Blazor* and Bolero* dependencies, remove version constraints if there are any (such as ~> 0.7.0), and add prerelease as a version constraint.
  • In src/*.Client/paket.references:

    • Replace Microsoft.AspNetCore.Blazor.Cli with Microsoft.AspNetCore.Blazor.DevServer.
  • In src/*.Server/paket.references:

    • Remove Microsoft.AspNetCore.App.
  • In both *.fsproj files, replace the TargetFramework from netcoreapp2.1 to netcoreapp3.0. Also, remove the following lines from *.Client.fsproj:

    <RunArguments>blazor serve</RunArguments>

You can now run .paket/paket update to update the packages. There are also a few code changes to apply:

  • In src/*.Client/Startup.fs:

    • Replace Microsoft.AspNetCore.Blazor.Builder with Microsoft.AspNetCore.Components.Builder.
    • Replace IBlazorApplicationBuilder with IComponentsApplicationBuilder.
  • In src/*.Server/Startup.fs:

    • Replace IHostingEnvironment with IWebHostEnvironment.

Your solution should now build and run successfully. If your code uses Blazor APIs directly, please check the Blazor 0.8, 0.9 and 3.0 upgrade guides for more code changes you might need to make.

If you are having any issues with this upgrade, don't hesitate to post an issue on GitHub!

You can’t perform that action at this time.