Skip to content

Commit

Permalink
Update Nimble / Spright Blazor to .NET 8 (#2454)
Browse files Browse the repository at this point in the history
# Pull Request

## 🤨 Rationale

Resolves #1667
- Split off resolving more code analysis suppressions to #2453 
- #2355 : Resolved by updates to Nimble/Spright JS initialization
scripts for .NET 8
- #2188 : Not reproducible by Nimble team, can debug further once
changes published if client can still reproduce

## 👩‍💻 Implementation

- Projects in Blazor solution now target `net8.0` (formerly `net6.0`)
- Update other .NET dependencies, and code analyzer package versions
- Update docs
- Re-build `Demo.Server` example based on new Blazor Web App template
- Update acceptance test projects to use similar setup as Blazor Web App
templates
- `NimbleBlazor.Tests.Acceptance.Client`: Existing tests use the
`InteractiveServer` render mode. The project also now supports tests
using `InteractiveWebAssembly` and static SSR render modes. Add one
example test for each.
- TODO: Spright acceptance test project currently don't use the new
setup yet. If the changes look reasonable and we want to do the same for
the Spright tests, I can do so in an update.

## 🧪 Testing

- Manual testing
- Autotests (unit/acceptance) pass. New tests for Nimble for
InteractiveWebAssembly / static SSR render modes.

## ✅ Checklist

- [x] I have updated the project documentation to reflect my changes or
determined no changes are needed.
  • Loading branch information
msmithNI authored Nov 1, 2024
1 parent a990204 commit cb7fd17
Show file tree
Hide file tree
Showing 105 changed files with 2,554 additions and 2,002 deletions.
1 change: 0 additions & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"matchManagers": ["nuget"],
"excludePackagePatterns":[
"Apache.Arrow",
"NI.CSharp.Analyzers",
"Microsoft.Playwright"
],
"enabled": true
Expand Down
30 changes: 30 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@
},
"problemMatcher": "$msCompile"
},
{
"label": "blazor-hybrid-example:build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/packages/blazor-workspace/Examples/Demo.Hybrid/Demo.Hybrid.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"options": {
"cwd": "${workspaceFolder}/packages/blazor-workspace/Examples/Demo.Hybrid/"
},
"problemMatcher": "$msCompile"
},
{
"label": "blazor-server-example:watch",
"command": "dotnet",
Expand Down Expand Up @@ -141,5 +156,20 @@
},
"problemMatcher": "$msCompile"
},
{
"label": "blazor-hybrid-example:watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/packages/blazor-workspace/Examples/Demo.Hybrid/Demo.Hybrid.csproj"
],
"options": {
"cwd": "${workspaceFolder}/packages/blazor-workspace/Examples/Demo.Hybrid/"
},
"problemMatcher": "$msCompile"
},
]
}
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ To submit changes to Nimble, the first step is to build the monorepo which requi
- Sync down a copy of the nimble repository
- Note: For one-off small contributions you can consider using a fork-pull workflow. However [fork-pull workflows are not yet supported](https://github.com/ni/nimble/issues/634) for substantial development. For substantial development you should be added as a Contributor to the repository. See the [`README.md` Community section](/README.md#community) to get in touch if you need Contributor permissions.
- Install Node.js version 22+ (run `node --version`) and npm version 10+ (run `npm --version`) which can be downloaded from https://nodejs.org/en/download/
- Install .NET 6 SDK (`6.0.418 <= version < 7`) which can be downloaded from https://dotnet.microsoft.com/en-us/download
- Run `dotnet --info` to verify the required version of the SDK is installed. A `v6` install is required, but it's fine if later versions are installed too.
- Install .NET 8 SDK (`8.0.403` or higher) which can be downloaded from https://dotnet.microsoft.com/en-us/download
- Run `dotnet --info` to verify the required version of the SDK is installed. A `v8` install is required, but it's fine if later versions are installed too.

From the `nimble` directory:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "Nimble Blazor targets (and requires) .NET 8. Update examples, docs, tests. See README for updated usage instructions.",
"packageName": "@ni/nimble-blazor",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "Spright Blazor targets (and requires) .NET 8. Update examples, docs, tests. See README for updated usage instructions.",
"packageName": "@ni/spright-blazor",
"email": "[email protected]",
"dependentChangeType": "patch"
}
18 changes: 17 additions & 1 deletion packages/blazor-workspace/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ dotnet_diagnostic.IDE0066.severity = none
# Disable general pattern matching rule for now, may opt in in the future
dotnet_diagnostic.IDE0078.severity = none

# Disabled during .NET 8 updates
dotnet_diagnostic.IDE0005.severity = suggestion
dotnet_diagnostic.IDE0100.severity = none
dotnet_diagnostic.IDE0200.severity = none
dotnet_diagnostic.IDE0300.severity = none
dotnet_diagnostic.IDE0290.severity = none
dotnet_diagnostic.IDE0028.severity = none
dotnet_diagnostic.IDE0301.severity = none
dotnet_diagnostic.IDE0090.severity = none
dotnet_diagnostic.IDE0028.severity = none
dotnet_diagnostic.BL0007.severity = none
dotnet_diagnostic.SYSLIB1045.severity = none
# dotnet format command throws an exception when IDE0130 (dotnet_style_namespace_match_folder)
# triggers - see https://github.com/dotnet/format/issues/1623
dotnet_diagnostic.IDE0130.severity = suggestion

[*.razor.cs]
# Spurious 'unused' warnings when properties/methods are only used from Razor files
dotnet_diagnostic.IDE0051.severity = none
Expand All @@ -45,7 +61,7 @@ dotnet_diagnostic.IDE0044.severity = none
# Spurious 'unnecessary using' warnings
dotnet_diagnostic.IDE0005.severity = none

[Tests/NimbleBlazor.Tests.Acceptance/Tests/*.cs]
[Tests/NimbleBlazor.Tests.Acceptance/Tests*/*.cs]
dotnet_style_namespace_match_folder = false
# Disable 'Namespace does not match folder structure'
dotnet_diagnostic.IDE0130.severity = none
Expand Down
33 changes: 20 additions & 13 deletions packages/blazor-workspace/BlazorWorkspace.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NimbleBlazor.Tests", "Tests
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{638B1C16-782F-4C91-A09C-3569957356DF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Client", "Examples\Demo.Client\Demo.Client.csproj", "{A8C1D36B-77FA-4D9B-893E-226FA2786D31}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Client", "Examples\Demo.Client\Demo.Client.csproj", "{63AFFE3B-A427-40B4-8079-CE6E6F1E8223}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Server", "Examples\Demo.Server\Demo.Server.csproj", "{6A1D0B77-BBF2-415E-B3A8-FAB00879F07C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Server", "Examples\Demo.Server\Demo.Server.csproj", "{08919E1A-D277-4F26-A85B-05CC736508BB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo.Shared", "Examples\Demo.Shared\Demo.Shared.csproj", "{8B6E367C-E472-4E68-98D2-968CFCF6939D}"
EndProject
Expand All @@ -27,7 +27,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SprightBlazor.Tests", "Test
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SprightBlazor.Tests.Acceptance", "Tests\SprightBlazor.Tests.Acceptance\SprightBlazor.Tests.Acceptance.csproj", "{8E335572-CD8B-4879-8760-73416CF103B1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorWorkspace.Testing.Acceptance", "Tests\BlazorWorkspace.Testing.Acceptance\BlazorWorkspace.Testing.Acceptance.csproj", "{D94A4535-51B3-4E70-9582-3F3A44C7A798}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWorkspace.Testing.Acceptance", "Tests\BlazorWorkspace.Testing.Acceptance\BlazorWorkspace.Testing.Acceptance.csproj", "{D94A4535-51B3-4E70-9582-3F3A44C7A798}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NimbleBlazor.Tests.Acceptance.Client", "Tests\NimbleBlazor.Tests.Acceptance.Client\NimbleBlazor.Tests.Acceptance.Client.csproj", "{27DB8F65-4848-4EA6-A7F2-86EF00D585FD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -43,14 +45,6 @@ Global
{1E11DA86-D43D-4CF7-94F5-B4565450BF4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E11DA86-D43D-4CF7-94F5-B4565450BF4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E11DA86-D43D-4CF7-94F5-B4565450BF4C}.Release|Any CPU.Build.0 = Release|Any CPU
{A8C1D36B-77FA-4D9B-893E-226FA2786D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A8C1D36B-77FA-4D9B-893E-226FA2786D31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A8C1D36B-77FA-4D9B-893E-226FA2786D31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A8C1D36B-77FA-4D9B-893E-226FA2786D31}.Release|Any CPU.Build.0 = Release|Any CPU
{6A1D0B77-BBF2-415E-B3A8-FAB00879F07C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A1D0B77-BBF2-415E-B3A8-FAB00879F07C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A1D0B77-BBF2-415E-B3A8-FAB00879F07C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A1D0B77-BBF2-415E-B3A8-FAB00879F07C}.Release|Any CPU.Build.0 = Release|Any CPU
{8B6E367C-E472-4E68-98D2-968CFCF6939D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8B6E367C-E472-4E68-98D2-968CFCF6939D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8B6E367C-E472-4E68-98D2-968CFCF6939D}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -79,20 +73,33 @@ Global
{D94A4535-51B3-4E70-9582-3F3A44C7A798}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D94A4535-51B3-4E70-9582-3F3A44C7A798}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D94A4535-51B3-4E70-9582-3F3A44C7A798}.Release|Any CPU.Build.0 = Release|Any CPU
{27DB8F65-4848-4EA6-A7F2-86EF00D585FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27DB8F65-4848-4EA6-A7F2-86EF00D585FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27DB8F65-4848-4EA6-A7F2-86EF00D585FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27DB8F65-4848-4EA6-A7F2-86EF00D585FD}.Release|Any CPU.Build.0 = Release|Any CPU
{63AFFE3B-A427-40B4-8079-CE6E6F1E8223}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63AFFE3B-A427-40B4-8079-CE6E6F1E8223}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63AFFE3B-A427-40B4-8079-CE6E6F1E8223}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63AFFE3B-A427-40B4-8079-CE6E6F1E8223}.Release|Any CPU.Build.0 = Release|Any CPU
{08919E1A-D277-4F26-A85B-05CC736508BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08919E1A-D277-4F26-A85B-05CC736508BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08919E1A-D277-4F26-A85B-05CC736508BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{08919E1A-D277-4F26-A85B-05CC736508BB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1E11DA86-D43D-4CF7-94F5-B4565450BF4C} = {E5C31FAF-7DEF-494F-A0D2-C9A4875F2132}
{A8C1D36B-77FA-4D9B-893E-226FA2786D31} = {638B1C16-782F-4C91-A09C-3569957356DF}
{6A1D0B77-BBF2-415E-B3A8-FAB00879F07C} = {638B1C16-782F-4C91-A09C-3569957356DF}
{8B6E367C-E472-4E68-98D2-968CFCF6939D} = {638B1C16-782F-4C91-A09C-3569957356DF}
{EAC50129-EF2E-4E7B-98D0-64502E97ED8B} = {638B1C16-782F-4C91-A09C-3569957356DF}
{7C65AEA1-8CA2-48DC-81FE-CE39295BDD4B} = {E5C31FAF-7DEF-494F-A0D2-C9A4875F2132}
{CEA7A89F-CF8E-4128-927E-24CBBF2C8C63} = {E5C31FAF-7DEF-494F-A0D2-C9A4875F2132}
{8E335572-CD8B-4879-8760-73416CF103B1} = {E5C31FAF-7DEF-494F-A0D2-C9A4875F2132}
{D94A4535-51B3-4E70-9582-3F3A44C7A798} = {E5C31FAF-7DEF-494F-A0D2-C9A4875F2132}
{27DB8F65-4848-4EA6-A7F2-86EF00D585FD} = {E5C31FAF-7DEF-494F-A0D2-C9A4875F2132}
{63AFFE3B-A427-40B4-8079-CE6E6F1E8223} = {638B1C16-782F-4C91-A09C-3569957356DF}
{08919E1A-D277-4F26-A85B-05CC736508BB} = {638B1C16-782F-4C91-A09C-3569957356DF}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {38E2A588-0714-41E7-9BA3-D89622560FF9}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
Expand All @@ -12,8 +12,8 @@
<Content Remove="packages.lock.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.33" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.33" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.10" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand All @@ -32,7 +32,7 @@
<None Include="packages.lock.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<PackageReference Include="NI.CSharp.Analyzers" Version="[2.0.21]" />
<PackageReference Include="NI.CSharp.Analyzers" Version="2.0.27" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion packages/blazor-workspace/Examples/Demo.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<Routes>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
Expand Down
Loading

0 comments on commit cb7fd17

Please sign in to comment.