Skip to content

Commit

Permalink
Upgrade all projects to .NET 8.0rc2 (#187)
Browse files Browse the repository at this point in the history
* Upgrade all projects to .NET 8.0rc2
Update all dependencies

* update NSwag to preview 14
fix nswag exec arguments

* upgrade Test projects to latest Test.Sdk preview version

* attempt to fix nswag execution on github - explicitly enabling compiler generated files to be emitted

* downgrade nswag.msbuild by one version - attempt 1

* revert nswag.msbuild version
fix global.json and explicitly install .net before autobuild

* restore global.json

* skip nswag when required

* don't need to explicitly install .net for codeql - it honours global.json
  • Loading branch information
william-liebenberg authored Oct 23, 2023
1 parent 07b8ec4 commit b76beb4
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 118 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:

- name: Autobuild
uses: github/codeql-action/autobuild@v2
env:
SkipNSwag: 'True'

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
12 changes: 6 additions & 6 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "7.0.200",
"rollForward": "latestFeature",
"allowPrerelease": false
}
{
"sdk": {
"version": "8.0.100-rc.2.23502.2",
"rollForward": "latestFeature",
"allowPrerelease": true
}
}
20 changes: 8 additions & 12 deletions src/Application/Application.csproj
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SSW.CleanArchitecture.Application</RootNamespace>
<AssemblyName>SSW.CleanArchitecture.Application</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Domain\Domain.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Ardalis.Specification.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.1" />
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.0" />
<PackageReference Include="MediatR" Version="12.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-rc.2.23480.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0-rc.2.23479.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0-rc.2.23479.6" />
</ItemGroup>

</Project>
</Project>
7 changes: 2 additions & 5 deletions src/Domain/Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SSW.CleanArchitecture.Domain</RootNamespace>
<AssemblyName>SSW.CleanArchitecture.Domain</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Ardalis.Specification" Version="7.0.0" />
<PackageReference Include="MediatR.Contracts" Version="2.0.1" />
</ItemGroup>

</Project>
</Project>
12 changes: 4 additions & 8 deletions src/Infrastructure/Infrastructure.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SSW.CleanArchitecture.Infrastructure</RootNamespace>
<AssemblyName>SSW.CleanArchitecture.Infrastructure</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Application\Application.csproj" />
<ProjectReference Include="..\Domain\Domain.csproj" />
</ItemGroup>

<ItemGroup>
<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0-rc.2.23480.1" />
</ItemGroup>

</Project>
</Project>
36 changes: 13 additions & 23 deletions src/WebApi/WebApi.csproj
Original file line number Diff line number Diff line change
@@ -1,55 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SSW.CleanArchitecture.WebApi</RootNamespace>
<AssemblyName>SSW.CleanArchitecture.WebApi</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="Application.IntegrationTests" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="7.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI" Version="7.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="7.1.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="7.0.10" />
<PackageReference Include="NSwag.AspNetCore" Version="13.19.0" />
<PackageReference Include="NSwag.MSBuild" Version="13.19.0">
<PackageReference Include="NSwag.AspNetCore" Version="14.0.0-preview008" />
<PackageReference Include="NSwag.MSBuild" Version="14.0.0-preview008">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0-rc.2.23480.1" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0-rc.2.23480.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Application\Application.csproj" />
<ProjectReference Include="..\Domain\Domain.csproj" />
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="wwwroot\api\" />
</ItemGroup>

<PropertyGroup>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent
</PropertyGroup>


<!--Condition="$(Configuration) == 'Release'"-->
<Target Name="SwaggerPostBuildClientAndSpec" AfterTargets="PostBuildEvent">
<!-- nswag will run all *.nswag and nswag.json by default -->       
<Exec WorkingDirectory="$(ProjectDir)" Command="$(NSwagExe_Net70) run /variables:Configuration=$(Configuration)" />
<Target Name="SwaggerPostBuildClientAndSpec" AfterTargets="PostBuildEvent" Condition="'$(SkipNSwag)' != 'True'">
<Message Text="----- Start generating Swagger specification using NSwag -----" Importance="high" />
<Exec WorkingDirectory="$(ProjectDir)" Command="$(NSwagExe_Net80) run nswag.json /variables:Configuration=$(Configuration)" />
<Message Text="----- Completed generating Swagger specification using NSwag -----" Importance="high" />
</Target>

</Project>
</Project>
2 changes: 1 addition & 1 deletion src/WebApi/nswag.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"runtime": "Net70",
"runtime": "Net80",
"defaultVariables": null,
"documentGenerator": {
"aspNetCoreToOpenApi": {
Expand Down
36 changes: 24 additions & 12 deletions src/WebApi/wwwroot/api/specification.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"x-generator": "NSwag v13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v10.0.0.0))",
"x-generator": "NSwag v14.0.0.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))",
"openapi": "3.0.0",
"info": {
"title": "CleanArchitecture API",
Expand All @@ -26,6 +26,19 @@
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TodoItemDto"
}
}
}
}
},
"500": {
"description": "",
"content": {
Expand All @@ -45,7 +58,6 @@
"operationId": "CreateTodoItem",
"requestBody": {
"x-name": "command",
"description": "",
"content": {
"application/json": {
"schema": {
Expand Down Expand Up @@ -109,15 +121,15 @@
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"Id": {
"type": "string",
"format": "guid"
},
"title": {
"Title": {
"type": "string",
"nullable": true
},
"done": {
"Done": {
"type": "boolean"
}
}
Expand All @@ -128,24 +140,24 @@
"nullable": true
},
"properties": {
"type": {
"Type": {
"type": "string",
"nullable": true
},
"title": {
"Title": {
"type": "string",
"nullable": true
},
"status": {
"Status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"Detail": {
"type": "string",
"nullable": true
},
"instance": {
"Instance": {
"type": "string",
"nullable": true
}
Expand All @@ -162,7 +174,7 @@
"nullable": true
},
"properties": {
"errors": {
"Errors": {
"type": "object",
"additionalProperties": {
"type": "array",
Expand All @@ -179,7 +191,7 @@
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"Title": {
"type": "string"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SSW.CleanArchitecture.Application.IntegrationTests</RootNamespace>
<AssemblyName>SSW.CleanArchitecture.Application.IntegrationTests</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
<PackageReference Include="Respawn" Version="6.0.0" />
<PackageReference Include="Testcontainers" Version="3.0.0" />
<PackageReference Include="Testcontainers.SqlEdge" Version="3.0.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="Respawn" Version="6.1.0" />
<PackageReference Include="Testcontainers" Version="3.5.0" />
<PackageReference Include="Testcontainers.SqlEdge" Version="3.5.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0-rc.2.23479.6" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\WebApi\WebApi.csproj" />
</ItemGroup>

</Project>
</Project>
18 changes: 7 additions & 11 deletions tests/Application.UnitTests/Application.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SSW.CleanArchitecture.Application.UnitTests</RootNamespace>
<AssemblyName>SSW.CleanArchitecture.Application.UnitTests</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0-preview-23503-02" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Application\Application.csproj" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public TodoItemByTitleSpecTests()
[Theory]
[InlineData("Apple")]
[InlineData("Banana")]
[InlineData("Apple 2")]
[InlineData("Banana 2")]
public void Should_Return_ByTitle(string textToSearch)
{
var query = new TodoItemByTitleSpec(textToSearch);
Expand Down
Loading

0 comments on commit b76beb4

Please sign in to comment.