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 run: dotnet build --no-restore
- name: Install playwright dependencies - name: Install playwright dependencies
shell: pwsh 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 - name: Install playwright
shell: pwsh 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 - name: Test project
run: dotnet test -e DOTNET_ENVIRONMENT=CI --no-build --verbosity normal -s ./test/Blog.Tests/ci.runsettings run: dotnet test -e DOTNET_ENVIRONMENT=CI --no-build --verbosity normal -s ./test/Blog.Tests/ci.runsettings
- name: Upload test results - name: Upload test results
@@ -49,4 +49,4 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: playwright-traces 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", "type": "coreclr",
"request": "launch", "request": "launch",
"preLaunchTask": "build_blog", "preLaunchTask": "build_blog",
"program": "${workspaceFolder}/src/Blog/bin/Debug/net8.0/Blog.dll", "program": "${workspaceFolder}/src/Blog/bin/Debug/net10.0/Blog.dll",
"args": [], "args": [],
"cwd": "${workspaceFolder}/src/Blog", "cwd": "${workspaceFolder}/src/Blog",
"stopAtEntry": false, "stopAtEntry": false,
+1
View File
@@ -3,6 +3,7 @@
"Abramov", "Abramov",
"Antiforgery", "Antiforgery",
"blazor", "blazor",
"Bunit",
"Deets", "Deets",
"Entitize", "Entitize",
"Hsts", "Hsts",
-1
View File
@@ -1,4 +1,3 @@
version: '3.8'
name: blog-development name: blog-development
services: services:
blog: blog:
-1
View File
@@ -1,4 +1,3 @@
version: '3.8'
name: blog-production name: blog-production
services: services:
blog: blog:
+4 -4
View File
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>16b1dba7-29d0-466e-bd34-16d8018898eb</UserSecretsId> <UserSecretsId>16b1dba7-29d0-466e-bd34-16d8018898eb</UserSecretsId>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Markdig" Version="0.40.0" /> <PackageReference Include="Markdig" Version="0.43.0" />
<PackageReference Include="System.ServiceModel.Syndication" Version="9.0.1" /> <PackageReference Include="System.ServiceModel.Syndication" Version="10.0.0" />
<PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" Version="21.2.12" /> <PackageReference Include="TestableIO.System.IO.Abstractions.Wrappers" Version="22.0.16" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+1 -13
View File
@@ -31,18 +31,6 @@
referrerpolicy="no-referrer-when-downgrade" /></noscript> referrerpolicy="no-referrer-when-downgrade" /></noscript>
} }
<script src="_framework/blazor.web.js"></script> <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> </body>
</html> </html>
+3 -3
View File
@@ -4,8 +4,8 @@
<div class="title-container"> <div class="title-container">
<NavLink href="/"> <NavLink href="/">
<h1>journal</h1> <h1>journal</h1>
<p>using <p>using
<a href="https://dotnet.microsoft.com/"> <a target="_blank" href="https://dotnet.microsoft.com/">
.NET @Environment.Version.Major .NET @Environment.Version.Major
</a> </a>
</p> </p>
@@ -18,4 +18,4 @@
<span class="sr-only">Stevan Freeborn</span> <span class="sr-only">Stevan Freeborn</span>
</a> </a>
</div> </div>
</header> </header>
+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 WORKDIR /app
COPY *.csproj ./ COPY *.csproj ./
RUN dotnet restore RUN dotnet restore
@@ -13,7 +13,7 @@ CMD ["dotnet", "watch"]
FROM setup-stage as build-stage FROM setup-stage as build-stage
RUN dotnet publish -c Release -o dist 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 WORKDIR /app
COPY --from=build-stage /app/dist ./ COPY --from=build-stage /app/dist ./
ENTRYPOINT ["dotnet", "Blog.dll"] ENTRYPOINT ["dotnet", "Blog.dll"]
+9 -9
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
@@ -10,19 +10,19 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="bunit" Version="1.38.5" /> <PackageReference Include="bunit" Version="2.1.1" />
<PackageReference Include="coverlet.msbuild" Version="6.0.4"> <PackageReference Include="coverlet.msbuild" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="FluentAssertions" Version="7.1.0" /> <PackageReference Include="FluentAssertions" Version="7.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Microsoft.Playwright.NUnit" Version="1.49.0" /> <PackageReference Include="Microsoft.Playwright.NUnit" Version="1.56.0" />
<PackageReference Include="moq" Version="4.20.72" /> <PackageReference Include="moq" Version="4.20.72" />
<PackageReference Include="NUnit" Version="4.3.2" /> <PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" /> <PackageReference Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.6.0" /> <PackageReference Include="NUnit.Analyzers" Version="4.11.2" />
<PackageReference Include="coverlet.collector" Version="6.0.4" /> <PackageReference Include="coverlet.collector" Version="6.0.4" />
</ItemGroup> </ItemGroup>
+1 -1
View File
@@ -1,7 +1,7 @@
namespace Blog.Tests.EndToEnd; namespace Blog.Tests.EndToEnd;
[TestFixture] [TestFixture]
public class BlogTest : PageTest public abstract class BlogTest : PageTest
{ {
private readonly BlogHostFactory<Program> _factory = new(); private readonly BlogHostFactory<Program> _factory = new();
+11 -11
View File
@@ -1,6 +1,6 @@
@inherits Bunit.TestContext @inherits Bunit.BunitContext
@code @code
{ {
private Mock<IPostService> _postServiceMock = new(); private Mock<IPostService> _postServiceMock = new();
@@ -8,10 +8,10 @@
public void Feed_WhenRendedAndNoPosts_ItShouldRenderNoPostsMessage() public void Feed_WhenRendedAndNoPosts_ItShouldRenderNoPostsMessage()
{ {
_postServiceMock _postServiceMock
.Setup(x => x.GetPostsAsync()) .Setup(x => x.GetPostsAsync())
.ReturnsAsync(new List<Post>()); .ReturnsAsync(new List<Post>());
var ctx = new TestContext(); var ctx = new BunitContext();
ctx.Services.AddSingleton(_postServiceMock.Object); ctx.Services.AddSingleton(_postServiceMock.Object);
@@ -24,15 +24,15 @@
public void Feed_WhenRendedAndPosts_ItShouldRenderPosts() public void Feed_WhenRendedAndPosts_ItShouldRenderPosts()
{ {
List<Post> posts = [ List<Post> posts = [
new Post() { Title = "Post 1", }, new Post() { Title = "Post 1", },
new Post() { Title = "Post 2", }, new Post() { Title = "Post 2", },
]; ];
_postServiceMock _postServiceMock
.Setup(x => x.GetPostsAsync()) .Setup(x => x.GetPostsAsync())
.ReturnsAsync(posts); .ReturnsAsync(posts);
var ctx = new TestContext(); var ctx = new BunitContext();
ctx.Services.AddScoped(_ => _postServiceMock.Object); ctx.Services.AddScoped(_ => _postServiceMock.Object);
+3 -3
View File
@@ -1,11 +1,11 @@
@inherits Bunit.TestContext @inherits Bunit.BunitContext
@code @code
{ {
[Test] [Test]
public void Footer_WhenRendered_ItShouldRenderFooterWithNavLinks() public void Footer_WhenRendered_ItShouldRenderFooterWithNavLinks()
{ {
var ctx = new TestContext(); var ctx = new BunitContext();
var cut = ctx.Render(@<Footer />); var cut = ctx.Render(@<Footer />);
+2 -2
View File
@@ -1,4 +1,4 @@
@inherits Bunit.TestContext @inherits Bunit.BunitContext
@code @code
{ {
@@ -29,4 +29,4 @@
var image = cut.Find("img[alt='Stevan Freeborn']"); var image = cut.Find("img[alt='Stevan Freeborn']");
image.Should().NotBeNull(); image.Should().NotBeNull();
} }
} }