Skip to content
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

Upgraded MudBlazor Templates to .NET 9 #482

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

jperson2000
Copy link
Contributor

@jperson2000 jperson2000 commented Nov 15, 2024

Description

Resolves: #481

This update upgrades MudBlazor templates to match the latest ASP.NET Core Blazor Project templates. Changes include a reduced amount of code for auth pages, a better way to detect render modes, and an upgrade to .NET 9. Overall, however, files are largely the same.

Changes were made by performing the following steps:

  1. Cloning the MudBlazor.Templates repo (clone link)
  2. Cloning the aspnetcore repo (clone link)
  3. Choose the net9 branch in aspnetcore
  4. Comparing the MudBlazor Templates folder against aspnetcore\src\ProjectTemplates\Web.ProjectTemplates\content\BlazorWeb-CSharp\BlazorWeb-CSharp in BeyondCompare and setting the local code folders via Set Base Folders
  5. Performing file-by-file comparisons and looking for changes apart from using MudBlazor components.

Special thanks once again to @Anu6is for the MudBlazor.Static library for the Account Management pages.

Using BeyondCompare to Update Templates

image

How Has This Been Tested?

This was tested by:

  1. Running .\InstallAndBuildAllTemplates.ps1 PowerShell script
  2. Observing that all builds succeeded
  3. Opening each solution and testing all links
Project Type Test Result
InteractivityAuto Successful (11/15/2024)
InteractivityAuto_AllInteractive Successful (11/15/2024)
InteractivityAuto_AllInteractive_Auth Successful (11/15/2024)
InteractivityAuto_Auth Successful (11/15/2024)
InteractivityAuto_UseMain Successful (11/15/2024)
InteractivityNone Successful (11/15/2024)
InteractivityServer Successful (11/15/2024)
InteractivityServer_AllInteractive Successful (11/15/2024)
InteractivityWebAssembly Successful (11/15/2024)
InteractivityWebAssembly_AllInteractive Successful (11/15/2024)

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

Comment on lines -55 to -61
{
"condition": "(!IndividualLocalAuth)",
"exclude": [
"**/wwwroot/bootstrap/**"
]
},
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines ensure that bootstrap isn't included in MudBlazor templates. However, we removed this folder in PR #465 and it won't appear again unless we start templates completely from scratch in the future.

@@ -130,7 +124,6 @@
"exclude": [
"MudBlazor.Template/Components/Account/**",
"MudBlazor.Template/Data/**",
"MudBlazor.Template.Client/PersistentAuthenticationStateProvider.cs",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This provider is no longer necessary as of .NET 9.

Comment on lines -151 to -157
"condition": "(!(IndividualLocalAuth && UseServer && UseWebAssembly))",
"exclude": [
"MudBlazor.Template/Components/Account/PersistingRevalidatingAuthenticationStateProvider.cs"
]
},
{
"condition": "(!(IndividualLocalAuth && UseServer && !UseWebAssembly))",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This provider has been completely removed in .NET 9.

@@ -2,6 +2,6 @@
<PageTitle>Reset password confirmation</PageTitle>

<h1>Reset password confirmation</h1>
<p>
Your password has been reset. Please <a class="mud-link mud-primary-text mud-link-underline-hover" href="Account/Login">click here to log in</a>.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, these CSS classes shouldn't have been deleted. I'll restore them.

@@ -1,3 +1,3 @@
@using MudBlazor
@using MudBlazor.Template.Components.Account.Shared
@layout AccountLayout
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, the entire AccountLayout.razor was deleted in the latest templates, and MainLayout.razor is used instead.

src/mudblazor/.template.config/template.json Outdated Show resolved Hide resolved
src/mudblazor/.template.config/template.json Outdated Show resolved Hide resolved
src/mudblazor/.template.config/template.json Outdated Show resolved Hide resolved
@jperson2000 jperson2000 changed the title Upgraded MudBlazor Templates to .NET 9 Upgraded MudBlazor Templates to .NET 10 Nov 15, 2024
@ScarletKuro
Copy link
Member

Was a little mistake to give the main branch instead of the tag 9.0, it seems the main is on two commits a head, but luckily it seems only the tempalate.json is different with the net.10, so here is the correct one for .net9.
https://github.com/dotnet/aspnetcore/blob/v9.0.0/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/template.json

@ScarletKuro
Copy link
Member

The rest seems to be the same

@jperson2000
Copy link
Contributor Author

Was a little mistake to give the main branch instead of the tag 9.0, it seems the main is on two commits a head, but luckily it seems only the tempalate.json is different with the net.10, so here is the correct one for .net9. https://github.com/dotnet/aspnetcore/blob/v9.0.0/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/template.json

You're totally right! That's a relief that only the template is different; I will get that sync'ed today then.

@jperson2000 jperson2000 changed the title Upgraded MudBlazor Templates to .NET 10 Upgraded MudBlazor Templates to .NET 9 Nov 15, 2024
@ScarletKuro
Copy link
Member

I added net9 to the build system, feel free to update the branch

@ScarletKuro
Copy link
Member

ScarletKuro commented Nov 15, 2024

Somehow it still fails to build in CI, tho it's fine locally via the nuke-build. Not sure why it still thinks net8 is installed. I will look at it tmr, too tired for it today.

@jperson2000 jperson2000 marked this pull request as ready for review November 15, 2024 17:16
Copy link

sonarcloud bot commented Nov 15, 2024

@jperson2000
Copy link
Contributor Author

Ok, I've finished testing all template projects and have verified that the new auth in .NET 9 is working as expected. I've restored the original Welcome message, and I think we're in good shape to review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.NET 9 Templates release date?
3 participants