Skip to content

Commit

Permalink
🚀 Upgrade to .NET 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ntxinh committed Nov 23, 2023
1 parent cf42387 commit b13c36e
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [workflow_dispatch]

env:
WEBAPP_PACKAGE_PATH: './published'
NETCORE_VERSION: '6.0.202'
NETCORE_VERSION: '8.0.0'
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

jobs:
Expand Down
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "watch",
"program": "${workspaceFolder}/Src/DDD.Services.Api/bin/Debug/net6.0/DDD.Services.Api.dll",
"program": "${workspaceFolder}/Src/DDD.Services.Api/bin/Debug/net8.0/DDD.Services.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/Src/DDD.Services.Api",
"stopAtEntry": false,
Expand All @@ -24,7 +24,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Src/DDD.Services.Api/bin/Debug/net6.0/DDD.Services.Api.dll",
"program": "${workspaceFolder}/Src/DDD.Services.Api/bin/Debug/net8.0/DDD.Services.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/Src/DDD.Services.Api",
"stopAtEntry": false,
Expand All @@ -39,7 +39,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Src/DDD.Services.Api/bin/Debug/net6.0/DDD.Services.Api.dll",
"program": "${workspaceFolder}/Src/DDD.Services.Api/bin/Debug/net8.0/DDD.Services.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/Src/DDD.Services.Api",
"stopAtEntry": false,
Expand All @@ -54,7 +54,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Src/DDD.Services.Api/bin/Debug/net6.0/DDD.Services.Api.dll",
"program": "${workspaceFolder}/Src/DDD.Services.Api/bin/Debug/net8.0/DDD.Services.Api.dll",
"args": [],
"cwd": "${workspaceFolder}/Src/DDD.Services.Api",
"stopAtEntry": false,
Expand Down
4 changes: 2 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# .NET Core SDK
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

# Sets the working directory
WORKDIR /app
Expand All @@ -25,7 +25,7 @@ COPY Src ./Src
RUN dotnet publish ./Src/DDD.Services.Api/DDD.Services.Api.csproj -c Release -o /publish

# ASP.NET Core Runtime
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=build /publish ./

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# .NET Core SDK
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

# Sets the working directory
WORKDIR /app
Expand All @@ -25,7 +25,7 @@ COPY Src ./Src
RUN dotnet publish ./Src/DDD.Services.Api/DDD.Services.Api.csproj -c Release -o /publish

# ASP.NET Core Runtime
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=build /publish ./

Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
![](/Docs/custom-repo-versus-db-context.png)

# Techical Stack
- ASP.NET Core 6.0 (with .NET 6.0)
- ASP.NET Core 8.0 (with .NET 8.0)
- ASP.NET WebApi Core
- ASP.NET Identity Core
- Entity Framework Core
Expand Down Expand Up @@ -52,7 +52,12 @@
- Options Pattern

# How to run
- Create file `C:\Users\[UserName]\AppData\Roaming\Microsoft\UserSecrets\51c0770a-8c88-4362-b3b5-a8936796ecef\secrets.json`

- Config User Secret:
+ Find `<user_secrets_id>` at `DDD.Services.Api.csproj` > `UserSecretsId` (Free to change to any GUID/UUID)
+ Windows: `C:\Users\[UserName]\AppData\Roaming\Microsoft\UserSecrets\<user_secrets_id>\secrets.json`
+ Linux / macOS: `~/.microsoft/usersecrets/<user_secrets_id>/secrets.json`


```json
{
Expand Down Expand Up @@ -140,7 +145,7 @@ podman-compose stop
- [x] Database Auditing: CreatedAt/UpdatedAt CreatedBy/UpdatedBy
- [x] Soft Delete
- [x] Common: Constants, Helpers
- [x] Docker
- [x] Docker, Docker Compose, Github Container Registry
- [x] EF: Shadow Properties
- [x] Events
- [x] Unit Testing
Expand Down
2 changes: 1 addition & 1 deletion Src/DDD.Application/DDD.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Application</RootNamespace>
<AssemblyName>DDD.Application</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
Expand Down
4 changes: 2 additions & 2 deletions Src/DDD.CLI.Migration/DDD.CLI.Migration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="dbup" Version="4.6.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
59 changes: 19 additions & 40 deletions Src/DDD.CLI.Migration/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 1,
"dependencies": {
"net6.0": {
"net8.0": {
"dbup": {
"type": "Direct",
"requested": "[4.6.0, )",
Expand All @@ -13,12 +13,12 @@
},
"System.Configuration.ConfigurationManager": {
"type": "Direct",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "7T+m0kDSlIPTHIkPMIu6m6tV6qsMqJpvQWW2jIc2qi7sn40qxFo0q+7mEQAhMPXZHMKnWrnv47ntGlM/ejvw3g==",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "JlYi9XVvIREURRUlGMr1F6vOFLk7YSY4p1vHo4kX3tQ0AGrjqlRWHDi66ImHhy6qwXBG3BJ6Y1QlYQ+Qz6Xgww==",
"dependencies": {
"System.Security.Cryptography.ProtectedData": "6.0.0",
"System.Security.Permissions": "6.0.0"
"System.Diagnostics.EventLog": "8.0.0",
"System.Security.Cryptography.ProtectedData": "8.0.0"
}
},
"dbup-core": {
Expand Down Expand Up @@ -96,11 +96,6 @@
"System.Security.Principal.Windows": "4.5.0"
}
},
"Microsoft.Win32.SystemEvents": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "hqTM5628jSsQiv+HGpiq3WKBl2c8v1KZfby2J6Pr7pEPlK9waPdgEO6b8A/+/xn/yZ9ulv8HuqK71ONy2tg67A=="
},
"NETStandard.Library": {
"type": "Transitive",
"resolved": "1.6.1",
Expand Down Expand Up @@ -376,6 +371,11 @@
"System.Threading": "4.3.0"
}
},
"System.Diagnostics.EventLog": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "fdYxcRjQqTTacKId/2IECojlDSFvp7LP5N78+0z/xH7v/Tuw5ZAxu23Y6PTCRinqyu2ePx+Gn1098NC6jM6d+A=="
},
"System.Diagnostics.Process": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -440,14 +440,6 @@
"System.Runtime": "4.3.0"
}
},
"System.Drawing.Common": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "NfuoKUiP2nUWwKZN6twGqXioIe1zVD0RIj2t976A+czLHr2nY454RwwXs6JU9Htc6mwqL6Dn/nEL3dpVf2jOhg==",
"dependencies": {
"Microsoft.Win32.SystemEvents": "6.0.0"
}
},
"System.Globalization": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -872,8 +864,12 @@
},
"System.Security.AccessControl": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ=="
"resolved": "4.5.0",
"contentHash": "vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==",
"dependencies": {
"Microsoft.NETCore.Platforms": "2.0.0",
"System.Security.Principal.Windows": "4.5.0"
}
},
"System.Security.Cryptography.Algorithms": {
"type": "Transitive",
Expand Down Expand Up @@ -989,8 +985,8 @@
},
"System.Security.Cryptography.ProtectedData": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "rp1gMNEZpvx9vP0JW0oHLxlf8oSiQgtno77Y4PLUBjSiDYoD77Y8uXHr1Ea5XG4/pIKhqAdxZ8v8OTUtqo9PeQ=="
"resolved": "8.0.0",
"contentHash": "+TUFINV2q2ifyXauQXRwy4CiBhqvDEDZeVJU7qfxya4aRYOKzVBpN+4acx25VcPB9ywUN6C0n8drWl110PhZEg=="
},
"System.Security.Cryptography.X509Certificates": {
"type": "Transitive",
Expand Down Expand Up @@ -1024,15 +1020,6 @@
"runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0"
}
},
"System.Security.Permissions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "T/uuc7AklkDoxmcJ7LGkyX1CcSviZuLCa4jg3PekfJ7SU0niF0IVTXwUiNVP9DSpzou2PpxJ+eNY2IfDM90ZCg==",
"dependencies": {
"System.Security.AccessControl": "6.0.0",
"System.Windows.Extensions": "6.0.0"
}
},
"System.Security.Principal.Windows": {
"type": "Transitive",
"resolved": "4.5.0",
Expand Down Expand Up @@ -1150,14 +1137,6 @@
"System.Runtime": "4.3.0"
}
},
"System.Windows.Extensions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "IXoJOXIqc39AIe+CIR7koBtRGMiCt/LPM3lI+PELtDIy9XdyeSrwXFdWV9dzJ2Awl0paLWUaknLxFQ5HpHZUog==",
"dependencies": {
"System.Drawing.Common": "6.0.0"
}
},
"System.Xml.ReaderWriter": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down
2 changes: 1 addition & 1 deletion Src/DDD.Domain.Core/DDD.Domain.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Domain.Core</RootNamespace>
<AssemblyName>DDD.Domain.Core</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
Expand Down
2 changes: 1 addition & 1 deletion Src/DDD.Domain/DDD.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Domain</RootNamespace>
<AssemblyName>DDD.Domain</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Infra.CrossCutting.Bus</RootNamespace>
<AssemblyName>DDD.Infra.CrossCutting.Bus</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Infra.CrossCutting.Identity</RootNamespace>
<AssemblyName>DDD.Infra.CrossCutting.Identity</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.11.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Infra.CrossCutting.IoC</RootNamespace>
<AssemblyName>DDD.Infra.CrossCutting.IoC</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
Expand Down
6 changes: 3 additions & 3 deletions Src/DDD.Infra.Data/DDD.Infra.Data.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Infra.Data</RootNamespace>
<AssemblyName>DDD.Infra.Data</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions Src/DDD.Services.Api/DDD.Services.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>DDD.Services.Api</RootNamespace>
Expand All @@ -17,10 +17,10 @@
<PackageReference Include="AspNetCore.HealthChecks.UI.InMemory.Storage" Version="5.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Application.UnitTests</RootNamespace>
<AssemblyName>DDD.Application.UnitTests</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>DDD.Services.Api.IntegrationTests</RootNamespace>
<AssemblyName>DDD.Services.Api.IntegrationTests</AssemblyName>
<AnalysisLevel>5</AnalysisLevel>
Expand All @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"sdk": {
"version": "6.0.202",
"rollForward": "latestMajor"
"version": "8.0.100"
}
}

0 comments on commit b13c36e

Please sign in to comment.