Skip to content

Commit 24b507e

Browse files
ggnaegiraman-m
andauthored
#1787 Upgrade to .NET 8 (#1789)
* Upgrade solution's projects to .net 8 * using .net 7.0 and .net 8.0 as target frameworks, adding conditions * checking indentation. Should it be 1,2,3 or 4? * target frameworks .net6.0, .net7.0 and .net8.0 * xml indentation * let's check this one... * some more cleanup * consolidate stylecop version * updating dockerfile.base to .net8 * udpating docker image build version to 0.0.10 * update config, maybe with some luck... * downstream service only available for .net 7 * adding indication about ISystemClock in .NET8 * adding comments for ClientWebSocketOptionsProxy * VS version vs .NET 8 SDK * Warning ASP0019 Use IHeaderDictionary.Append or the indexer to append or set headers. IDictionary.Add will throw an ArgumentException when attempting to add a duplicate key. * updated config * Update Docker images & CircleCI config * ocelot2/circleci-build:latest * Use image: ocelot2/circleci-build:latest * our friend GivenThereIsAPossiblyBrokenServiceRunningOn is back. I allow myself to push this fix - already implemented in the develop branch - --------- Co-authored-by: raman-m <[email protected]>
1 parent d3a623e commit 24b507e

File tree

63 files changed

+764
-639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+764
-639
lines changed

.circleci/config.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ orbs:
44
jobs:
55
build:
66
docker:
7-
- image: mijitt0m/ocelot-build:0.0.9
7+
- image: ocelot2/circleci-build:latest
88
steps:
99
- checkout
1010
- run: dotnet tool restore && dotnet cake
1111
release:
1212
docker:
13-
- image: mijitt0m/ocelot-build:0.0.9
13+
- image: ocelot2/circleci-build:latest
1414
steps:
1515
- checkout
1616
- run: dotnet tool restore && dotnet cake --target=Release
@@ -19,7 +19,7 @@ workflows:
1919
main:
2020
jobs:
2121
- queue/block_workflow:
22-
time: "20"
22+
time: '20'
2323
only-on-branch: main
2424
- release:
2525
requires:
@@ -38,6 +38,6 @@ workflows:
3838
- build:
3939
filters:
4040
branches:
41-
ignore:
41+
ignore:
4242
- main
4343
- develop

.editorconfig

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ root = true
44
end_of_line = lf
55
insert_final_newline = true
66

7-
[*.cs]
7+
[*.cs]
88
end_of_line = lf
99
indent_style = space
1010
indent_size = 4
11+
12+
# XML files
13+
[*.xml]
14+
indent_style = space
15+
indent_size = 2

Ocelot.sln

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
1+
22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
4-
VisualStudioVersion = 17.6.33723.286
4+
VisualStudioVersion = 17.8.34309.116
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5CFB79B7-C9DC-45A4-9A75-625D92471702}"
77
EndProject

docker/Dockerfile.base

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine
22

33
RUN apk add bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib git openssh-client
44

55
RUN curl -L --output ./dotnet-install.sh https://dot.net/v1/dotnet-install.sh
66

77
RUN chmod u+x ./dotnet-install.sh
88

9+
# Install .NET 8 SDK (already included in the base image, but listed for consistency)
10+
RUN ./dotnet-install.sh -c 8.0 -i /usr/share/dotnet
11+
12+
# Install .NET 7 SDK
13+
RUN ./dotnet-install.sh -c 7.0 -i /usr/share/dotnet
14+
15+
# Install .NET 6 SDK
916
RUN ./dotnet-install.sh -c 6.0 -i /usr/share/dotnet

docker/Dockerfile.build

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# call from ocelot repo root with
22
# docker build --platform linux/arm64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
33
# docker build --platform linux/amd64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
4-
FROM mijitt0m/ocelot-build:0.0.9
4+
5+
FROM ocelot2/circleci-build:latest
56

67
ARG OCELOT_COVERALLS_TOKEN
78

@@ -13,4 +14,4 @@ COPY ./. .
1314

1415
RUN dotnet tool restore
1516

16-
RUN dotnet cake
17+
RUN dotnet cake

docker/Dockerfile.release

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# call from ocelot repo root with
22
# docker build --platform linux/arm64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
33
# docker build --platform linux/amd64 --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN --build-arg OCELOT_GITHUB_API_KEY=$OCELOT_GITHUB_API_KEY --build-arg OCELOT_COVERALLS_TOKEN=$OCELOT_COVERALLS_TOKEN -f ./docker/Dockerfile.build .
4-
FROM mijitt0m/ocelot-build:0.0.9
4+
5+
FROM ocelot2/circleci-build:latest
56

67
ARG OCELOT_COVERALLS_TOKEN
78
ARG OCELOT_NUTGET_API_KEY
@@ -17,4 +18,4 @@ COPY ./. .
1718

1819
RUN dotnet tool restore
1920

20-
RUN dotnet cake
21+
RUN dotnet cake

docker/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# docker build
22

3-
This folder contains the dockerfile and script to create the ocelot build container.
3+
This folder contains the `Dockerfile.*` and `build.sh` script to create the Ocelot build image & container.

docker/build.sh

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
# this script build the ocelot docker file
2-
version=0.0.9
3-
docker build --platform linux/amd64 -t mijitt0m/ocelot-build -f Dockerfile.base .
1+
# This script builds the Ocelot Docker file
2+
3+
# {DotNetSdkVer}.{OcelotVer} -> {.NET8}.{21.0} -> 8.21.0
4+
version=8.21.0
5+
docker build --platform linux/amd64 -t ocelot2/circleci-build -f Dockerfile.base .
6+
47
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
5-
docker tag mijitt0m/ocelot-build mijitt0m/ocelot-build:$version
6-
docker push mijitt0m/ocelot-build:latest
7-
docker push mijitt0m/ocelot-build:$version
8+
9+
docker tag ocelot2/circleci-build ocelot2/circleci-build:$version
10+
docker push ocelot2/circleci-build:latest
11+
docker push ocelot2/circleci-build:$version
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>net7.0</TargetFramework>
3+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
44
<ImplicitUsings>disable</ImplicitUsings>
55
<Nullable>disable</Nullable>
66
</PropertyGroup>
77
<ItemGroup>
88
<Folder Include="wwwroot\" />
99
</ItemGroup>
1010
<ItemGroup>
11-
<PackageReference Include="Ocelot" Version="18.0.0" />
12-
<PackageReference Include="Ocelot.Administration" Version="18.0.0" />
13-
11+
<ProjectReference Include="..\..\src\Ocelot.Administration\Ocelot.Administration.csproj" />
12+
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
1413
</ItemGroup>
1514
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
32
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
3+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
54
<ImplicitUsings>disable</ImplicitUsings>
65
<Nullable>disable</Nullable>
76
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
87
</PropertyGroup>
9-
108
<ItemGroup>
119
<Folder Include="Properties\" />
1210
</ItemGroup>
13-
1411
<ItemGroup>
1512
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
1613
</ItemGroup>
17-
1814
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
5-
<ImplicitUsings>disable</ImplicitUsings>
6-
<Nullable>disable</Nullable>
7-
</PropertyGroup>
8-
9-
<ItemGroup>
10-
<Folder Include="wwwroot\" />
11-
</ItemGroup>
12-
13-
<ItemGroup>
14-
<None Update="ocelot.json;appsettings.json">
15-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
16-
</None>
17-
</ItemGroup>
18-
19-
<ItemGroup>
20-
<PackageReference Include="Ocelot" Version="18.0.0" />
21-
<PackageReference Include="Ocelot.Provider.Eureka" Version="18.0.0" />
22-
<PackageReference Include="Ocelot.Provider.Polly" Version="18.0.0" />
23-
</ItemGroup>
24-
25-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
<PropertyGroup>
3+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
4+
<ImplicitUsings>disable</ImplicitUsings>
5+
<Nullable>disable</Nullable>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<Folder Include="wwwroot\" />
9+
</ItemGroup>
10+
<ItemGroup>
11+
<None Update="ocelot.json;appsettings.json">
12+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
13+
</None>
14+
</ItemGroup>
15+
<ItemGroup>
16+
<ProjectReference Include="..\..\..\src\Ocelot.Provider.Eureka\Ocelot.Provider.Eureka.csproj" />
17+
<ProjectReference Include="..\..\..\src\Ocelot.Provider.Polly\Ocelot.Provider.Polly.csproj" />
18+
<ProjectReference Include="..\..\..\src\Ocelot\Ocelot.csproj" />
19+
</ItemGroup>
20+
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
5-
<ImplicitUsings>disable</ImplicitUsings>
6-
<Nullable>disable</Nullable>
7-
</PropertyGroup>
8-
9-
<ItemGroup>
10-
<Folder Include="wwwroot\" />
11-
</ItemGroup>
12-
13-
<ItemGroup>
14-
<PackageReference Include="Steeltoe.Discovery.Client" Version="1.1.0" />
15-
</ItemGroup>
16-
17-
<ItemGroup>
18-
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
19-
</ItemGroup>
20-
21-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
<PropertyGroup>
3+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
4+
<ImplicitUsings>disable</ImplicitUsings>
5+
<Nullable>disable</Nullable>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<Folder Include="wwwroot\" />
9+
</ItemGroup>
10+
<ItemGroup>
11+
<PackageReference Include="Steeltoe.Discovery.Client" Version="1.1.0" />
12+
</ItemGroup>
13+
<ItemGroup>
14+
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.3" />
15+
</ItemGroup>
16+
</Project>
+20-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
<PropertyGroup>
3-
<TargetFramework>net7.0</TargetFramework>
4-
<ImplicitUsings>disable</ImplicitUsings>
5-
<Nullable>disable</Nullable>
6-
</PropertyGroup>
7-
<ItemGroup>
8-
<None Update="ocelot.json;appsettings.json">
9-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
10-
</None>
11-
</ItemGroup>
12-
<ItemGroup>
13-
<Folder Include="wwwroot\" />
14-
</ItemGroup>
15-
<ItemGroup>
16-
<PackageReference Include="Ocelot" Version="18.0.0" />
17-
<PackageReference Include="GraphQL" Version="4.8.0" />
18-
</ItemGroup>
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
<PropertyGroup>
3+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
4+
<ImplicitUsings>disable</ImplicitUsings>
5+
<Nullable>disable</Nullable>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<Folder Include="wwwroot\" />
9+
</ItemGroup>
10+
<ItemGroup>
11+
<None Update="ocelot.json;appsettings.json">
12+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
13+
</None>
14+
</ItemGroup>
15+
<ItemGroup>
16+
<PackageReference Include="GraphQL" Version="4.8.0" />
17+
</ItemGroup>
18+
<ItemGroup>
19+
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
20+
</ItemGroup>
1921
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
32
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
3+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
54
<ImplicitUsings>disable</ImplicitUsings>
65
<Nullable>disable</Nullable>
76
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
87
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
98
</PropertyGroup>
10-
119
<ItemGroup>
12-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
10+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
1311
</ItemGroup>
14-
1512
<ItemGroup>
1613
<ProjectReference Include="..\..\..\src\Ocelot.Provider.Kubernetes\Ocelot.Provider.Kubernetes.csproj" />
1714
<ProjectReference Include="..\..\..\src\Ocelot\Ocelot.csproj" />
1815
</ItemGroup>
19-
2016
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
32
<PropertyGroup>
43
<TargetFramework>net7.0</TargetFramework>
54
<ImplicitUsings>disable</ImplicitUsings>
65
<Nullable>disable</Nullable>
76
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
87
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
98
</PropertyGroup>
10-
119
<ItemGroup>
12-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
1310
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
1411
</ItemGroup>
15-
1612
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
<Project Sdk="Microsoft.NET.Sdk.Worker">
2-
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
65
<ImplicitUsings>disable</ImplicitUsings>
76
<Nullable>disable</Nullable>
87
</PropertyGroup>
9-
108
<ItemGroup>
119
<PackageReference Include="Jaeger" Version="1.0.3" />
12-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
10+
1311
</ItemGroup>
14-
1512
<ItemGroup>
1613
<ProjectReference Include="..\..\src\Ocelot.Tracing.OpenTracing\Ocelot.Tracing.OpenTracing.csproj" />
1714
<ProjectReference Include="..\..\src\Ocelot\Ocelot.csproj" />
1815
</ItemGroup>
19-
16+
<!-- Conditionally obtain references for the net 6.0 target -->
17+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
18+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
19+
</ItemGroup>
20+
<!-- Conditionally obtain references for the net 7.0 target -->
21+
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
22+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
23+
</ItemGroup>
24+
<!-- Conditionally obtain references for the net 8.0 target -->
25+
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
26+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
27+
</ItemGroup>
2028
<ItemGroup>
2129
<Content Update="appsettings.Development.json">
2230
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
@@ -28,5 +36,4 @@
2836
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
2937
</Content>
3038
</ItemGroup>
31-
3239
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2-
32
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
3+
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
54
</PropertyGroup>
6-
75
<ItemGroup>
86
<ProjectReference Include="..\..\..\src\Ocelot\Ocelot.csproj" />
97
</ItemGroup>
10-
118
</Project>

0 commit comments

Comments
 (0)