Merge pull request #43 from StevanFreeborn/stevanfreeborn/feat/🥳-upgrade-to-dotnet-10

feat: upgrade to .NET 10
This commit is contained in:
Stevan Freeborn
2025-11-22 07:35:15 -06:00
committed by GitHub
14 changed files with 41 additions and 54 deletions
+3 -3
View File
@@ -33,10 +33,10 @@ jobs:
run: dotnet build --no-restore
- name: Install playwright dependencies
shell: pwsh
run: ./test/Blog.Tests/bin/Debug/net9.0/playwright.ps1 install-deps
run: ./test/Blog.Tests/bin/Debug/net10.0/playwright.ps1 install-deps
- name: Install playwright
shell: pwsh
run: ./test/Blog.Tests/bin/Debug/net9.0/playwright.ps1 install
run: ./test/Blog.Tests/bin/Debug/net10.0/playwright.ps1 install
- name: Test project
run: dotnet test -e DOTNET_ENVIRONMENT=CI --no-build --verbosity normal -s ./test/Blog.Tests/ci.runsettings
- name: Upload test results
@@ -49,4 +49,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: playwright-traces
path: ./test/Blog.Tests/bin/Debug/net9.0/playwright-traces
path: ./test/Blog.Tests/bin/Debug/net10.0/playwright-traces
+1 -1
View File
@@ -22,7 +22,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build_blog",
"program": "${workspaceFolder}/src/Blog/bin/Debug/net8.0/Blog.dll",
"program": "${workspaceFolder}/src/Blog/bin/Debug/net10.0/Blog.dll",
"args": [],
"cwd": "${workspaceFolder}/src/Blog",
"stopAtEntry": false,
+1
View File
@@ -3,6 +3,7 @@
"Abramov",
"Antiforgery",
"blazor",
"Bunit",
"Deets",
"Entitize",
"Hsts",
-1
View File
@@ -1,4 +1,3 @@
version: '3.8'
name: blog-development
services:
blog:
-1
View File
@@ -1,4 +1,3 @@
version: '3.8'
name: blog-production
services:
blog:
+4 -4
View File
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>16b1dba7-29d0-466e-bd34-16d8018898eb</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Markdig" Version="0.40.0" />
<PackageReference Include="System.ServiceModel.Syndication" Version="9.0.1" />
<PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" Version="21.2.12" />
<PackageReference Include="Markdig" Version="0.43.0" />
<PackageReference Include="System.ServiceModel.Syndication" Version="10.0.0" />
<PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" Version="22.0.16" />
</ItemGroup>
<ItemGroup>
-12
View File
@@ -31,18 +31,6 @@
referrerpolicy="no-referrer-when-downgrade" /></noscript>
}
<script src="_framework/blazor.web.js"></script>
<script>
// NOTE: This is a workaround for the issue with FocusOnNavigate in Blazor
// not playing nicely with static site generation.
// read more here: https://github.com/dotnet/aspnetcore/issues/52412
window.Blazor.addEventListener("enhancedload", () => {
if (window.location.pathname === "/") {
return;
}
window.scroll({ top: 0, left: 0, behavior: 'instant' });
});
</script>
</body>
</html>
+1 -1
View File
@@ -5,7 +5,7 @@
<NavLink href="/">
<h1>journal</h1>
<p>using
<a href="https://dotnet.microsoft.com/">
<a target="_blank" href="https://dotnet.microsoft.com/">
.NET @Environment.Version.Major
</a>
</p>
+2 -2
View File
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS setup-stage
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS setup-stage
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
@@ -13,7 +13,7 @@ CMD ["dotnet", "watch"]
FROM setup-stage as build-stage
RUN dotnet publish -c Release -o dist
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS production-stage
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS production-stage
WORKDIR /app
COPY --from=build-stage /app/dist ./
ENTRYPOINT ["dotnet", "Blog.dll"]
+9 -9
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
@@ -10,19 +10,19 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="bunit" Version="1.38.5" />
<PackageReference Include="bunit" Version="2.1.1" />
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="7.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Microsoft.Playwright.NUnit" Version="1.49.0" />
<PackageReference Include="FluentAssertions" Version="7.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.Playwright.NUnit" Version="1.56.0" />
<PackageReference Include="moq" Version="4.20.72" />
<PackageReference Include="NUnit" Version="4.3.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.6.0" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.11.2" />
<PackageReference Include="coverlet.collector" Version="6.0.4" />
</ItemGroup>
+1 -1
View File
@@ -1,7 +1,7 @@
namespace Blog.Tests.EndToEnd;
[TestFixture]
public class BlogTest : PageTest
public abstract class BlogTest : PageTest
{
private readonly BlogHostFactory<Program> _factory = new();
+10 -10
View File
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext
@code
{
@@ -8,10 +8,10 @@
public void Feed_WhenRendedAndNoPosts_ItShouldRenderNoPostsMessage()
{
_postServiceMock
.Setup(x => x.GetPostsAsync())
.ReturnsAsync(new List<Post>());
.Setup(x => x.GetPostsAsync())
.ReturnsAsync(new List<Post>());
var ctx = new TestContext();
var ctx = new BunitContext();
ctx.Services.AddSingleton(_postServiceMock.Object);
@@ -24,15 +24,15 @@
public void Feed_WhenRendedAndPosts_ItShouldRenderPosts()
{
List<Post> posts = [
new Post() { Title = "Post 1", },
new Post() { Title = "Post 2", },
];
new Post() { Title = "Post 1", },
new Post() { Title = "Post 2", },
];
_postServiceMock
.Setup(x => x.GetPostsAsync())
.ReturnsAsync(posts);
.Setup(x => x.GetPostsAsync())
.ReturnsAsync(posts);
var ctx = new TestContext();
var ctx = new BunitContext();
ctx.Services.AddScoped(_ => _postServiceMock.Object);
+2 -2
View File
@@ -1,11 +1,11 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext
@code
{
[Test]
public void Footer_WhenRendered_ItShouldRenderFooterWithNavLinks()
{
var ctx = new TestContext();
var ctx = new BunitContext();
var cut = ctx.Render(@<Footer />);
+1 -1
View File
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext
@inherits Bunit.BunitContext
@code
{