From 21a124075b887c283503ed2cb91aec5fd9bc7994 Mon Sep 17 00:00:00 2001 From: Daniel Lerch <36048059+daniel-lerch@users.noreply.github.com> Date: Wed, 15 Nov 2023 14:08:16 +0100 Subject: [PATCH] Upgrade to .NET 8.0 Default port changes from 80 to 8080 --- .github/workflows/main.yml | 2 +- Dockerfile | 4 ++-- src/TravelBlog/Program.cs | 2 +- src/TravelBlog/TravelBlog.csproj | 18 +++++++++--------- src/TravelBlog/Views/Shared/_Layout.cshtml | 2 +- .../JobSchedulerServiceTests.cs | 4 ++-- tests/TravelBlog.Tests/TravelBlog.Tests.csproj | 10 +++++----- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2327581..1d6ff6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore NuGet packages run: dotnet restore - name: Build diff --git a/Dockerfile b/Dockerfile index 7441502..56f14c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env WORKDIR /app # Copy csproj and restore as distinct layers @@ -14,7 +14,7 @@ COPY . ./ RUN dotnet publish --no-restore -c Release -o /app/out src/TravelBlog/TravelBlog.csproj # Build runtime image -FROM mcr.microsoft.com/dotnet/aspnet:6.0 +FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /app COPY --from=build-env /app/out . ENTRYPOINT ["dotnet", "TravelBlog.dll"] diff --git a/src/TravelBlog/Program.cs b/src/TravelBlog/Program.cs index f37916d..36680c9 100644 --- a/src/TravelBlog/Program.cs +++ b/src/TravelBlog/Program.cs @@ -97,7 +97,7 @@ public static void Main(string[] args) app.UseCookiePolicy(); app.UseAuthentication(); app.UseAuthorization(); - app.UseEndpoints(endpoints => endpoints.MapControllers()); + app.MapControllers(); app.Run(); } } diff --git a/src/TravelBlog/TravelBlog.csproj b/src/TravelBlog/TravelBlog.csproj index 66967bf..6744966 100644 --- a/src/TravelBlog/TravelBlog.csproj +++ b/src/TravelBlog/TravelBlog.csproj @@ -1,28 +1,28 @@  - net6.0 + net8.0 enable Daniel Lerch - © 2019-2022 Daniel Lerch + © 2019-2023 Daniel Lerch MIT License 9eb7eda1-7c08-4fa1-aca3-363ec6bc312e - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/src/TravelBlog/Views/Shared/_Layout.cshtml b/src/TravelBlog/Views/Shared/_Layout.cshtml index 64f55bf..327ccbf 100644 --- a/src/TravelBlog/Views/Shared/_Layout.cshtml +++ b/src/TravelBlog/Views/Shared/_Layout.cshtml @@ -71,7 +71,7 @@ diff --git a/tests/TravelBlog.Tests/JobSchedulerServiceTests.cs b/tests/TravelBlog.Tests/JobSchedulerServiceTests.cs index 55fcc52..f69bb58 100644 --- a/tests/TravelBlog.Tests/JobSchedulerServiceTests.cs +++ b/tests/TravelBlog.Tests/JobSchedulerServiceTests.cs @@ -20,7 +20,7 @@ public async Task TestStart() Assert.Equal(new[] { data }, await context.GetJobs()); data.SetResult(true); await Task.Delay(50); - Assert.Equal(0, (await context.GetJobs()).Count); + Assert.Empty(await context.GetJobs()); await jobScheduler.StopAsync(default); } @@ -41,7 +41,7 @@ public async Task TestStop() Assert.False(stop.IsCompleted); data.SetResult(true); await stop; - Assert.Equal(0, (await context.GetJobs()).Count); + Assert.Empty(await context.GetJobs()); } [Fact] diff --git a/tests/TravelBlog.Tests/TravelBlog.Tests.csproj b/tests/TravelBlog.Tests/TravelBlog.Tests.csproj index b30e561..bca3207 100644 --- a/tests/TravelBlog.Tests/TravelBlog.Tests.csproj +++ b/tests/TravelBlog.Tests/TravelBlog.Tests.csproj @@ -1,20 +1,20 @@ - net6.0 + net8.0 enable false - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all