Skip to content

Commit a5a8552

Browse files
committed
Update to .NET 8 and 9
1 parent a911300 commit a5a8552

File tree

16 files changed

+67
-48
lines changed

16 files changed

+67
-48
lines changed

.github/workflows/ci.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ jobs:
88
runs-on: windows-latest
99

1010
steps:
11-
- uses: actions/checkout@v1
11+
- uses: actions/checkout@v4
1212

1313
- uses: aarnott/[email protected]
1414
with:
1515
setAllVars: true
1616

1717
- name: Setup .NET Core SDK
18-
uses: actions/setup-dotnet@v1.7.2
18+
uses: actions/setup-dotnet@v4
1919
with:
20-
version: 3.1.100
20+
dotnet-version: |
21+
8.0.x
22+
9.0.x
2123
2224
- name: dotnet build
2325
run: dotnet build BedrockFramework.sln -c Release

BedrockFramework.sln

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29112.163
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35410.144 d17.12
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientApplication", "samples\ClientApplication\ClientApplication.csproj", "{44A257ED-D3A7-4170-BE67-4392F2A6FE18}"
77
EndProject
@@ -20,6 +20,9 @@ EndProject
2020
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EA6E96E9-C7CC-4051-8E3A-28236CE32CFD}"
2121
ProjectSection(SolutionItems) = preProject
2222
Directory.Build.props = Directory.Build.props
23+
global.json = global.json
24+
nuget.config = nuget.config
25+
version.json = version.json
2326
EndProjectSection
2427
EndProject
2528
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bedrock.Framework.Experimental", "src\Bedrock.Framework.Experimental\Bedrock.Framework.Experimental.csproj", "{B77439AE-01C0-4877-AF91-180D521F6E55}"

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
</PropertyGroup>
1313
<ItemGroup Condition="$(IsPackable) == 'true'">
1414
<PackageReference Include="Nerdbank.GitVersioning">
15-
<Version>3.3.37</Version>
15+
<Version>3.6.146</Version>
1616
<PrivateAssets>all</PrivateAssets>
1717
</PackageReference>
18-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
18+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
1919
</ItemGroup>
2020
</Project>

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "9.0.100"
4+
}
5+
}

samples/ClientApplication/ClientApplication.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
5+
<TargetFrameworks>net9.0</TargetFrameworks>
66
</PropertyGroup>
77

88
<ItemGroup>
@@ -14,8 +14,8 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.5" />
18-
<PackageReference Include="MQTTnet.AspNetCore" Version="3.1.2" />
17+
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="9.0.0" />
18+
<PackageReference Include="MQTTnet.AspNetCore" Version="4.3.7.1207" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

samples/ClientApplication/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private static async Task EchoServerWithTls(ServiceProvider serviceProvider)
268268
o.TargetHost = "foo";
269269
};
270270

271-
options.LocalCertificate = new X509Certificate2("testcert.pfx", "testcert");
271+
options.LocalCertificate = X509CertificateLoader.LoadPkcs12FromFile("testcert.pfx", "testcert");
272272

273273
// NOTE: Do not do this in a production environment
274274
options.AllowAnyRemoteCertificate();
@@ -360,7 +360,7 @@ private static async Task DockerDaemon(IServiceProvider serviceProvider)
360360
.UseConnectionLogging()
361361
.Build();
362362

363-
await using var connection = await client.ConnectAsync(new NamedPipeEndPoint("docker_engine"));
363+
await using var connection = await client.ConnectAsync(new Bedrock.Framework.NamedPipeEndPoint("docker_engine"));
364364

365365
// Use the HTTP/1.1 protocol
366366
var httpProtocol = new HttpClientProtocol(connection);

samples/ServerApplication/MqttApplication.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
using System.Collections.Generic;
2-
using System.Threading;
3-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
2+
using Microsoft.AspNetCore.Connections;
43
using MQTTnet.Adapter;
54
using MQTTnet.AspNetCore;
65
using MQTTnet.Packets;
76
using MQTTnet.Protocol;
87

98
namespace ServerApplication
109
{
11-
public class MqttApplication : MqttConnectionHandler
10+
public class MqttApplication : ConnectionHandler
1211
{
12+
private MqttConnectionHandler _mqttHandler = new();
13+
1314
public MqttApplication()
1415
{
15-
ClientHandler = OnClientConnectedAsync;
16+
_mqttHandler.ClientHandler = OnClientConnectedAsync;
17+
}
18+
19+
public override async Task OnConnectedAsync(ConnectionContext connection)
20+
{
21+
await _mqttHandler.OnConnectedAsync(connection);
1622
}
1723

1824
private async Task OnClientConnectedAsync(IMqttChannelAdapter adapter)
@@ -43,8 +49,7 @@ await adapter.SendPacketAsync(new MqttConnAckPacket
4349
case MqttSubscribePacket mqttSubscribePacket:
4450
var ack = new MqttSubAckPacket
4551
{
46-
PacketIdentifier = mqttSubscribePacket.PacketIdentifier,
47-
ReturnCodes = new List<MqttSubscribeReturnCode> { MqttSubscribeReturnCode.SuccessMaximumQoS0 }
52+
PacketIdentifier = mqttSubscribePacket.PacketIdentifier
4853
};
4954
ack.ReasonCodes.Add(MqttSubscribeReasonCode.GrantedQoS0);
5055

samples/ServerApplication/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static async Task Main(string[] args)
4949
sockets.Listen(IPAddress.Loopback, 5004,
5050
builder => builder.UseServerTls(options =>
5151
{
52-
options.LocalCertificate = new X509Certificate2("testcert.pfx", "testcert");
52+
options.LocalCertificate = X509CertificateLoader.LoadPkcs12FromFile("testcert.pfx", "testcert");
5353

5454
// NOTE: Do not do this in a production environment
5555
options.AllowAnyRemoteCertificate();

samples/ServerApplication/ServerApplication.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
5+
<TargetFrameworks>net9.0</TargetFrameworks>
66
</PropertyGroup>
77

88
<ItemGroup>
99
<Content Include="..\Certs\testcert.pfx" Link="testcert.pfx" CopyToOutputDirectory="PreserveNewest" />
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="MQTTnet.AspNetCore" Version="3.1.2" />
13+
<PackageReference Include="MQTTnet.AspNetCore" Version="4.3.7.1207" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

src/Bedrock.Framework.Experimental/Bedrock.Framework.Experimental.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
55
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
66
<PackageDescription>Experimental protocols and transports for Bedrock.Framework.</PackageDescription>
77
<Authors>David Fowler</Authors>
@@ -18,20 +18,21 @@
1818
</ItemGroup>
1919

2020
<Choose>
21-
<When Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
21+
<When Condition="'$(TargetFramework)' == 'net8.0'">
2222
<ItemGroup>
23-
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Client" Version="3.1.0" />
23+
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Client" Version="8.0.11" />
2424
</ItemGroup>
2525
</When>
2626
<Otherwise>
2727
<ItemGroup>
28-
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Client" Version="6.0.5" />
28+
<PackageReference Include="Microsoft.AspNetCore.Http.Connections.Client" Version="9.0.0" />
2929
</ItemGroup>
3030
</Otherwise>
3131
</Choose>
3232

3333
<ItemGroup>
34-
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.1.1" />
34+
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
35+
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.146" />
3536
</ItemGroup>
3637

3738
<ItemGroup>

0 commit comments

Comments
 (0)