Skip to content

Commit d02542f

Browse files
committed
Multi-target C# tutorials
Because .NET 8 and .NET 10 are LTS versions.
1 parent a5f1567 commit d02542f

16 files changed

Lines changed: 44 additions & 44 deletions

File tree

dotnet-amqp/EmitLog/EmitLog.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

dotnet-amqp/EmitLogDirect/EmitLogDirect.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

dotnet-amqp/EmitLogTopic/EmitLogTopic.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

dotnet-amqp/NewTask/NewTask.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

dotnet-amqp/PublisherConfirms/PublisherConfirms.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

dotnet-amqp/README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Here you can find C# examples from the [RabbitMQ tutorials](https://www.rabbitmq
44

55
You need a RabbitMQ node running locally. The client requires **RabbitMQ 4.0 or newer** with AMQP 1.0 on port **5672**. The examples use the default `guest` user. See the [AMQP 1.0 client libraries overview](https://www.rabbitmq.com/client-libraries/amqp-client-libraries) and [AMQP in RabbitMQ](https://www.rabbitmq.com/docs/amqp).
66

7-
There is a solution file for Visual Studio 2022 (`dotnet-amqp.sln`). From this directory, use `dotnet run --project` as below.
7+
There is a solution file for Visual Studio 2022 (`dotnet-amqp.sln`). From this directory, use `dotnet run -f net8.0 --project` as below.
88

99
End-to-end smoke tests (broker on `localhost`, management plugin used to reset `hello` / `task_queue` when needed):
1010

@@ -14,7 +14,7 @@ End-to-end smoke tests (broker on `localhost`, management plugin used to reset `
1414

1515
## Requirements
1616

17-
- [.NET 8 SDK](https://dotnet.microsoft.com/download)
17+
- [.NET 8 or .NET 10 SDK](https://dotnet.microsoft.com/download) (projects target `net8.0` and `net10.0`; use `-f net10.0` instead of `-f net8.0` in the commands below if you prefer)
1818
- NuGet package: `RabbitMQ.AMQP.Client` (see each `.csproj`; restore runs automatically with `dotnet run` or `dotnet build`)
1919

2020
## Code
@@ -24,71 +24,71 @@ Run each example from the `dotnet-amqp` directory.
2424
#### Tutorial one: "Hello World!"
2525

2626
```bash
27-
dotnet run --project Receive/Receive.csproj
28-
dotnet run --project Send/Send.csproj
27+
dotnet run -f net8.0 --project Receive/Receive.csproj
28+
dotnet run -f net8.0 --project Send/Send.csproj
2929
```
3030

3131
#### Tutorial two: Work Queues
3232

3333
```bash
34-
dotnet run --project Worker/Worker.csproj
35-
dotnet run --project Worker/Worker.csproj
36-
dotnet run --project NewTask/NewTask.csproj "First Message"
37-
dotnet run --project NewTask/NewTask.csproj "Second Message"
38-
dotnet run --project NewTask/NewTask.csproj "Third Message"
39-
dotnet run --project NewTask/NewTask.csproj "Fourth Message"
40-
dotnet run --project NewTask/NewTask.csproj "Fifth Message"
34+
dotnet run -f net8.0 --project Worker/Worker.csproj
35+
dotnet run -f net8.0 --project Worker/Worker.csproj
36+
dotnet run -f net8.0 --project NewTask/NewTask.csproj "First Message"
37+
dotnet run -f net8.0 --project NewTask/NewTask.csproj "Second Message"
38+
dotnet run -f net8.0 --project NewTask/NewTask.csproj "Third Message"
39+
dotnet run -f net8.0 --project NewTask/NewTask.csproj "Fourth Message"
40+
dotnet run -f net8.0 --project NewTask/NewTask.csproj "Fifth Message"
4141
```
4242

4343
#### Tutorial three: Publish/Subscribe
4444

4545
```bash
46-
dotnet run --project ReceiveLogs/ReceiveLogs.csproj
47-
dotnet run --project ReceiveLogs/ReceiveLogs.csproj
48-
dotnet run --project EmitLog/EmitLog.csproj
46+
dotnet run -f net8.0 --project ReceiveLogs/ReceiveLogs.csproj
47+
dotnet run -f net8.0 --project ReceiveLogs/ReceiveLogs.csproj
48+
dotnet run -f net8.0 --project EmitLog/EmitLog.csproj
4949
```
5050

5151
#### Tutorial four: Routing
5252

5353
```bash
54-
dotnet run --project ReceiveLogsDirect/ReceiveLogsDirect.csproj warning error
55-
dotnet run --project ReceiveLogsDirect/ReceiveLogsDirect.csproj info warning error
56-
dotnet run --project EmitLogDirect/EmitLogDirect.csproj info "Run. Run. Or it will explode."
57-
dotnet run --project EmitLogDirect/EmitLogDirect.csproj warning "Run. Run. Or it will explode."
58-
dotnet run --project EmitLogDirect/EmitLogDirect.csproj error "Run. Run. Or it will explode."
54+
dotnet run -f net8.0 --project ReceiveLogsDirect/ReceiveLogsDirect.csproj warning error
55+
dotnet run -f net8.0 --project ReceiveLogsDirect/ReceiveLogsDirect.csproj info warning error
56+
dotnet run -f net8.0 --project EmitLogDirect/EmitLogDirect.csproj info "Run. Run. Or it will explode."
57+
dotnet run -f net8.0 --project EmitLogDirect/EmitLogDirect.csproj warning "Run. Run. Or it will explode."
58+
dotnet run -f net8.0 --project EmitLogDirect/EmitLogDirect.csproj error "Run. Run. Or it will explode."
5959
```
6060

6161
#### Tutorial five: Topics
6262

6363
```bash
64-
dotnet run --project ReceiveLogsTopic/ReceiveLogsTopic.csproj "#"
65-
dotnet run --project ReceiveLogsTopic/ReceiveLogsTopic.csproj "kern.*"
66-
dotnet run --project ReceiveLogsTopic/ReceiveLogsTopic.csproj "*.critical"
67-
dotnet run --project ReceiveLogsTopic/ReceiveLogsTopic.csproj "kern.*" "*.critical"
68-
dotnet run --project EmitLogTopic/EmitLogTopic.csproj kern.critical "A critical kernel error"
64+
dotnet run -f net8.0 --project ReceiveLogsTopic/ReceiveLogsTopic.csproj "#"
65+
dotnet run -f net8.0 --project ReceiveLogsTopic/ReceiveLogsTopic.csproj "kern.*"
66+
dotnet run -f net8.0 --project ReceiveLogsTopic/ReceiveLogsTopic.csproj "*.critical"
67+
dotnet run -f net8.0 --project ReceiveLogsTopic/ReceiveLogsTopic.csproj "kern.*" "*.critical"
68+
dotnet run -f net8.0 --project EmitLogTopic/EmitLogTopic.csproj kern.critical "A critical kernel error"
6969
```
7070

7171
#### Tutorial six: RPC
7272

7373
```bash
74-
dotnet run --project RPCServer/RPCServer.csproj
75-
dotnet run --project RPCClient/RPCClient.csproj
74+
dotnet run -f net8.0 --project RPCServer/RPCServer.csproj
75+
dotnet run -f net8.0 --project RPCClient/RPCClient.csproj
7676
```
7777

7878
The client requests Fibonacci numbers for `0` through `31`, matching the Java AMQP 1.0 tutorial client.
7979

8080
#### Publisher confirms (AMQP 1.0 publish outcomes)
8181

8282
```bash
83-
dotnet run --project PublisherConfirms/PublisherConfirms.csproj
83+
dotnet run -f net8.0 --project PublisherConfirms/PublisherConfirms.csproj
8484
```
8585

8686
#### AMQP 1.0 Direct Reply-To RPC
8787

8888
On RabbitMQ **4.2 and newer**, the .NET `Requester` uses [Direct Reply-To](https://www.rabbitmq.com/docs/direct-reply-to) when no explicit reply queue is set (see the client’s requester implementation). Older brokers fall back to a temporary reply queue.
8989

9090
```bash
91-
dotnet run --project RpcAmqp10/RpcAmqp10.csproj
91+
dotnet run -f net8.0 --project RpcAmqp10/RpcAmqp10.csproj
9292
```
9393

9494
This sample runs a responder and a requester in one process; press CTRL+C to exit.

dotnet-amqp/RPCClient/RPCClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

dotnet-amqp/RPCServer/RPCServer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

dotnet-amqp/Receive/Receive.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

dotnet-amqp/ReceiveLogs/ReceiveLogs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

0 commit comments

Comments
 (0)