Skip to content

Commit

Permalink
Upgrade API to .NET 9.0 to fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Edwards committed Aug 28, 2024
1 parent 62c422b commit c501ddd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Crypter.API/Crypter.API.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -18,16 +18,16 @@
<ProjectReference Include="..\Crypter.Core\Crypter.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-preview.3.24172.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.3.24172.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0-preview.7.24405.4" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0-preview.3.24172.13" />
<PackageReference Include="System.Drawing.Common" Version="9.0.0-preview.3.24172.9" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions Crypter.API/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0-preview AS build
WORKDIR /source/

RUN dotnet tool install --global dotnet-ef --version 8.0.*
RUN dotnet tool install --global dotnet-ef --version 9.0.0-preview.7.24405.3
ENV PATH="${PATH}:/root/.dotnet/tools"

COPY ../*.sln ./
Expand All @@ -24,7 +24,7 @@ COPY Crypter.DataAccess/. ./Crypter.DataAccess/
RUN dotnet publish Crypter.API --configuration release --no-self-contained /p:TreatWarningsAsErrors=true /warnaserror --output /app/
RUN dotnet-ef migrations bundle --project Crypter.DataAccess --startup-project Crypter.API --configuration release --no-build --target-runtime linux-x64 --output /app/efbundle --verbose

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0-preview AS runtime
WORKDIR /app
COPY --from=build /app ./
CMD ["dotnet", "Crypter.API.dll"]
2 changes: 1 addition & 1 deletion Crypter.API/Middleware/ExceptionHandlerMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task Invoke(HttpContext context)
ErrorResponseItem errorItem =
new ErrorResponseItem((int)InfrastructureErrorCode.InvalidEnumValueErrorCode, ex.Message);
ErrorResponse errorResponse =
new ErrorResponse((int)HttpStatusCode.BadRequest, new List<ErrorResponseItem> { errorItem });
new ErrorResponse((int)HttpStatusCode.BadRequest, [errorItem]);
await response.WriteAsJsonAsync(errorResponse);
}
catch (TaskCanceledException)
Expand Down

0 comments on commit c501ddd

Please sign in to comment.