Skip to content

Commit f0a3be5

Browse files
committed
Migrate Microservices Project to .Net 5
1 parent 93dd0c5 commit f0a3be5

File tree

16 files changed

+49
-48
lines changed

16 files changed

+49
-48
lines changed
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
66
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
77
<DockerfileContext>..\..\..</DockerfileContext>
88
</PropertyGroup>
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
12-
<PackageReference Include="Ocelot" Version="15.0.6" />
12+
<PackageReference Include="Ocelot" Version="16.0.1" />
1313
</ItemGroup>
1414

1515
</Project>

src/ApiGateway/APIGateway/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
44
WORKDIR /app
55
EXPOSE 80
66

7-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
88
WORKDIR /src
99
COPY ["src/ApiGateway/APIGateway/APIGateway.csproj", "src/ApiGateway/APIGateway/"]
1010
RUN dotnet restore "src/ApiGateway/APIGateway/APIGateway.csproj"
@@ -18,4 +18,4 @@ RUN dotnet publish "APIGateway.csproj" -c Release -o /app/publish
1818
FROM base AS final
1919
WORKDIR /app
2020
COPY --from=publish /app/publish .
21-
ENTRYPOINT ["dotnet", "APIGateway.dll"]
21+
ENTRYPOINT ["dotnet", "APIGateway.dll"]

src/ApiGateway/APIGateway/ocelot.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"ReRoutes": [
2+
"Routes": [
33
//Catalog API
44
{
55
"DownstreamPathTemplate": "/api/v1/Catalog",

src/Basket/Basket.API/Basket.API.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
66
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
77
<DockerfileContext>..\..\..</DockerfileContext>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
11+
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
1212
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
1313
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
14-
<PackageReference Include="StackExchange.Redis" Version="2.1.30" />
15-
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
14+
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
15+
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

src/Basket/Basket.API/Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
44
WORKDIR /app
55
EXPOSE 80
66

7-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
88
WORKDIR /src
99
COPY ["src/Basket/Basket.API/Basket.API.csproj", "src/Basket/Basket.API/"]
10+
COPY ["src/Common/EventBusRabbitMQ/EventBusRabbitMQ.csproj", "src/Common/EventBusRabbitMQ/"]
1011
RUN dotnet restore "src/Basket/Basket.API/Basket.API.csproj"
1112
COPY . .
1213
WORKDIR "/src/src/Basket/Basket.API"
@@ -18,4 +19,4 @@ RUN dotnet publish "Basket.API.csproj" -c Release -o /app/publish
1819
FROM base AS final
1920
WORKDIR /app
2021
COPY --from=publish /app/publish .
21-
ENTRYPOINT ["dotnet", "Basket.API.dll"]
22+
ENTRYPOINT ["dotnet", "Basket.API.dll"]

src/Catalog/Catalog.API/Catalog.API.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
66
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
77
<DockerfileContext>..\..\..</DockerfileContext>
88
</PropertyGroup>
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
12-
<PackageReference Include="MongoDB.Driver" Version="2.10.4" />
13-
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
12+
<PackageReference Include="MongoDB.Driver" Version="2.11.4" />
13+
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
1414
</ItemGroup>
1515

1616

src/Catalog/Catalog.API/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
44
WORKDIR /app
55
EXPOSE 80
66

7-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
88
WORKDIR /src
99
COPY ["src/Catalog/Catalog.API/Catalog.API.csproj", "src/Catalog/Catalog.API/"]
1010
RUN dotnet restore "src/Catalog/Catalog.API/Catalog.API.csproj"
@@ -18,4 +18,4 @@ RUN dotnet publish "Catalog.API.csproj" -c Release -o /app/publish
1818
FROM base AS final
1919
WORKDIR /app
2020
COPY --from=publish /app/publish .
21-
ENTRYPOINT ["dotnet", "Catalog.API.dll"]
21+
ENTRYPOINT ["dotnet", "Catalog.API.dll"]
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
9-
<PackageReference Include="RabbitMQ.Client" Version="6.0.0" />
9+
<PackageReference Include="RabbitMQ.Client" Version="6.2.1" />
1010
</ItemGroup>
1111

1212
</Project>

src/Ordering/Ordering.API/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
44
WORKDIR /app
55
EXPOSE 80
66

7-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
7+
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
88
WORKDIR /src
99
COPY ["src/Ordering/Ordering.API/Ordering.API.csproj", "src/Ordering/Ordering.API/"]
1010
COPY ["src/Ordering/Ordering.Application/Ordering.Application.csproj", "src/Ordering/Ordering.Application/"]
@@ -22,4 +22,4 @@ RUN dotnet publish "Ordering.API.csproj" -c Release -o /app/publish
2222
FROM base AS final
2323
WORKDIR /app
2424
COPY --from=publish /app/publish .
25-
ENTRYPOINT ["dotnet", "Ordering.API.dll"]
25+
ENTRYPOINT ["dotnet", "Ordering.API.dll"]

src/Ordering/Ordering.API/Ordering.API.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
66
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
77
<DockerfileContext>..\..\..</DockerfileContext>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
12-
<PackageReference Include="MediatR" Version="8.0.1" />
13-
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.0.0" />
14-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.4">
11+
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
12+
<PackageReference Include="MediatR" Version="9.0.0" />
13+
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>
1818
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
19-
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
19+
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
2020
</ItemGroup>
2121

2222
<ItemGroup>

src/Ordering/Ordering.Application/Ordering.Application.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="AutoMapper" Version="9.0.0" />
9-
<PackageReference Include="FluentValidation" Version="8.6.2" />
10-
<PackageReference Include="MediatR" Version="8.0.1" />
8+
<PackageReference Include="AutoMapper" Version="10.1.1" />
9+
<PackageReference Include="FluentValidation" Version="9.3.0" />
10+
<PackageReference Include="MediatR" Version="9.0.0" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

src/Ordering/Ordering.Application/PipelineBehaviours/ValidationBehaviour.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public ValidationBehaviour(IEnumerable<IValidator<TRequest>> validators)
1919

2020
public Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken, RequestHandlerDelegate<TResponse> next)
2121
{
22-
var context = new ValidationContext(request);
22+
var context = new ValidationContext<TRequest>(request);
2323
var failures = _validators
2424
.Select(x => x.Validate(context))
2525
.SelectMany(x => x.Errors)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
</PropertyGroup>
66

77
</Project>

src/Ordering/Ordering.Infrastructure/Ordering.Infrastructure.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
9-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.4">
8+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0" />
9+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0">
1010
<PrivateAssets>all</PrivateAssets>
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>
13-
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.4" />
14-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.4" />
15-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.4">
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.0" />
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
1616
<PrivateAssets>all</PrivateAssets>
1717
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1818
</PackageReference>

src/WebApp/AspnetRunBasics/AspnetRunBasics.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net5.0</TargetFramework>
55
<UserSecretsId>cd5124f0-00bb-4cff-b8b9-dc4e11396fa3</UserSecretsId>
66
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
77
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
@@ -14,9 +14,9 @@
1414

1515
<ItemGroup>
1616
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
17-
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.4" />
17+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
1818
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
19-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.2" />
19+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.0" />
2020
</ItemGroup>
2121

2222

src/WebApp/AspnetRunBasics/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
22

3-
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
3+
FROM mcr.microsoft.com/dotnet/aspnet:5.0-buster-slim AS base
44
WORKDIR /app
55
EXPOSE 80
66
EXPOSE 443
77

8-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
8+
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
99
WORKDIR /src
1010
COPY ["src/WebApp/AspnetRunBasics/AspnetRunBasics.csproj", "src/WebApp/AspnetRunBasics/"]
1111
RUN dotnet restore "src/WebApp/AspnetRunBasics/AspnetRunBasics.csproj"
@@ -19,4 +19,4 @@ RUN dotnet publish "AspnetRunBasics.csproj" -c Release -o /app/publish
1919
FROM base AS final
2020
WORKDIR /app
2121
COPY --from=publish /app/publish .
22-
ENTRYPOINT ["dotnet", "AspnetRunBasics.dll"]
22+
ENTRYPOINT ["dotnet", "AspnetRunBasics.dll"]

0 commit comments

Comments
 (0)