Skip to content

Latest commit

 

History

History
84 lines (68 loc) · 4.74 KB

README.md

File metadata and controls

84 lines (68 loc) · 4.74 KB

New Project Template - HAVIT Blazor Stack

Documentation

See the documentation (/doc/README.md).

Clonning template contents into new folder

If you have a local repository
git checkout-index --prefix=git-export-dir/ -a

Or create a new GitHub repository from template:
https://github.com/havit/NewProjectTemplate-Blazor/generate

Initial Setup

  1. SetupSolution.ps1 (replaces NewProjectTemplate with YourProjectName etc.)
    1. Open SetupSolution.ps1 and set parameters.
    2. Run SetupSolution.ps1.
    3. Delete SetupSolution.ps1
  2. Set Web.Server as the startup project.
  3. Adjust the Model - remove unnecessary entities (Country, Localizations, ...)
  4. Rebuild the solution
  5. Run DataLayer CodeGenerator (Run-CodeGenerator.ps1)
  6. Create an initial EF migration
    1. Drop the current migrations - delete Entity/Migrations folder
    2. Add new initial migration Add-Migration Initial
  7. Check all configuration files (including PublishScripts folder).
    1. Remove connection string AzureKeyVault from appsettings.WebServer.Development.json (or update the endpoint).
  8. Run the app...

Further Steps

  1. Update NuGet packages in solution.
  2. Application Insights - configure connection string

(Use PublishScripts folder for deployment settings.)

Upgrading Blazor Web App security to OIDC & cookie authentication

  1. Repeat changes in the commit ce3cf6a7ddc472804046c68d323a13e74c9af1ba

Upgrading Blazor WebAssembly to Blazor Web App (net8)

  1. Repeat changes in the commit ed6fb5c13cb5f2bea15d4429bbaa8d982e601798 ("core update")
  2. Repeat changes in the commit 72fd697a29660f8218bfc7754d973634ee8b11c8 (updates BlazorApplicationInsights)

Upgrading existing project from net7 to net8

  1. Replace the <TargetFramework>net7.0</TargetFramework> to <TargetFramework>net8.0</TargetFramework> in all .csproj files.
  2. Update NuGet package references from 7.0.x to 8.0.x version + update other NuGet packages as needed (do not update to EF Core 8 until fully supported by HFW).
  3. Build: Clean solution & Rebuild solution
  4. Deal with [Obsolete] APIs:
    1. Remove <HxAnchorFragmentNavigation /> component, if you are using it (anchor-navigation is handled by Blazor now)
  5. In dotnet-tools.json upgrade Havit.Data.EntityFrameworkCore.CodeGenerator.Tool to 2.8.0+ version (net8) + try if the DataLayer/Run-CodeGenerator.ps1 runs correctly
  6. Check the TfsPublish.xml. There might be explicit net7 target, update it to net8.
  7. Update the Web.Server.csproj the EnsureWebJobInPackage target to use net8.0 in paths.
  8. If you use it, upgrade your GitHub workflow YAML to use net8.
  9. For AAD, if you use JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();, replace it with JsonWebTokenHandler.DefaultInboundClaimTypeMap.Clear();.
  10. If you are hitting the "undefined" is not valid JSON when logging in (or just "Login failed"), disable assembly trimming for Microsoft.AspNetCore.Components.WebAssembly.Authentication (yes, again), see dotnet/aspnetcore#49956

Upgrading existing project from net6 to net7

  1. Replace the <TargetFramework>net6.0</TargetFramework> to <TargetFramework>net7.0</TargetFramework> in all .csproj files.
  2. Update NuGet package references from 6.0.x to 7.0.x version + update other NuGet packages as needed.
  3. Build: Clean solution & Rebuild solution
  4. Deal with [Obsolete] APIs:
    1. Replace SignOutSessionStateManager (LoginDisplat.razor) with NavigationManager.NavigateToLogout(), see CS0618
  5. Deal with unsupported platform APIs
    1. In Web.Server/Program.cs, update the AddEventLog() call:
    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
    {
    	logging.AddEventLog();
    }
  6. Deal with new code analyzer warnings, e.g.
    1. BL0007: Component parameter 'XY' should be auto property
      1. use @bind:after where applicable
      2. use #pragma warning disable where needed
  7. In dotnet-tools.json upgrade Havit.Data.EntityFrameworkCore.CodeGenerator.Tool to 2.7.0 version (net7) + try if the DataLayer/Run-CodeGenerator.ps1 runs correctly
  8. Check the TfsPublish.xml. There might be explicit net6 target, update it to net7.
  9. Update the Web.Server.csproj the EnsureWebJobInPackage target to use net7.0 in paths.
  10. If you use it, upgrade your GitHub workflow YAML to use net7.
  11. If you are hitting the "undefined" is not valid JSON when logging in, disable assembly trimming for Microsoft.AspNetCore.Components.WebAssembly.Authentication, see dotnet/aspnetcore#44981
  12. Remove the Blazor GC gRPC workaround when using facades (revert the Func<IXyFacade> usage to direct IXyFacade usage))