10000 update dotnet tutorial to use dotnet core instead of mono · syk-coder/rabbitmq-tutorials@6dac939 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6dac939

Browse files
committed
update dotnet tutorial to use dotnet core instead of mono
1 parent 77167bf commit 6dac939

28 files changed

+292
-121
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ ruby*/rubygems*
1818

1919
java*/.idea/workspace.xml
2020
java*/.idea/encodings.xml
21-
*~
21+
*~
22+
23+
.vscode/
24+
obj/
25+
bin/
File renamed without changes.

dotnet/EmitLog/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}
File renamed without changes.

dotnet/EmitLogDirect/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}
File renamed without changes.

dotnet/EmitLogTopic/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}
File renamed without changes.

dotnet/NewTask/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}

dotnet/README.md

Lines changed: 19 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -9,140 +9,47 @@ To successfully use the examples you will need a running RabbitMQ server.
99

1010
### Requirements on Windows
1111

12-
You need the RabbitMQ dotnet client.
13-
14-
* Download [RabbitMQ .NET client](https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_5_4/rabbitmq-dotnet-client-3.5.4-dotnet-4.0.zip)
15-
* Extract it and copy "RabbitMQ.Client.dll" to your working folder.
16-
17-
You also need to ensure your system can find the C# compiler `csc.exe`,
18-
you may need to add `;C:\Windows\Microsoft.NET\Framework\v4.0.30319` (change .NET version
19-
to fit your installation) to your `PATH`.
12+
* [dotnet core](https://www.microsoft.com/net/core)
2013

2114
We're using the command line (start->run cmd.exe) to
22-
compile and run the code. Alternatively you could [use Visual Studio](https://github.com/rabbitmq/rabbitmq-tutorials/tree/master/dotnet-visual-studio) and [NuGet package](https://www.nuget.org/packages/RabbitMQ.Client/), but
23-
this set of tutorials assumes the command line.
15+
compile and run -p the code. Alternatively you could [use Visual Studio](https://github.com/rabbitmq/rabbitmq-tutorials/tree/master/dotnet-visual-studio) and [NuGet package](https://www.nuget.org/packages/RabbitMQ.Client/), but this set of tutorials assumes
16+
the command line.
2417

2518
### Requirements on Linux
2619

27-
You need Mono and RabbitMQ dotnet client.
28-
29-
sudo apt-get install mono-devel
30-
mkdir lib
31-
cd lib
32-
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_5_4/rabbitmq-dotnet-client-3.5.4-dotnet-4.0.zip
33-
unzip rabbitmq-dotnet-client-3.5.4-dotnet-4.0.zip
34-
cd ..
35-
20+
* [dotnet core](https://www.microsoft.com/net/core)
3621

3722
## Code
3823

39-
#### [Tutorial one: "Hello World!"](http://www.rabbitmq.com/tutorial-one-dotnet.html)
40-
41-
##### Windows
42-
43-
csc /r:"RabbitMQ.Client.dll" Send.cs
44-
csc /r:"RabbitMQ.Client.dll" Receive.cs
45-
46-
Send.exe
47-
Receive.exe
48-
49-
##### Linux
50-
51-
gmcs -r:lib/bin/RabbitMQ.Client.dll Send.cs
52-
gmcs -r:lib/bin/RabbitMQ.Client.dll Receive.cs
24+
Each command is best run -p in a separate console/terminal instance run from the root
25+
of the tutorial directory.
5326

54-
MONO_PATH=lib/bin mono Send.exe
55-
MONO_PATH=lib/bin mono Receive.exe
27+
#### [Tutorial one: "Hello World!"](http://www.rabbitmq.com/tutorial-one-dotnet.html)
5628

29+
dotnet run -p Receive
30+
dotnet run -p Send
5731

5832
#### [Tutorial two: Work Queues](http://www.rabbitmq.com/tutorial-two-dotnet.html)
5933

60-
61-
##### Windows
62-
63-
csc /r:"RabbitMQ.Client.dll" NewTask.cs
64-
csc /r:"RabbitMQ.Client.dll" Worker.cs
65-
66-
NewTask.exe
67-
Worker.exe
68-
69-
##### Linux
70-
71-
gmcs -r:lib/bin/RabbitMQ.Client.dll NewTask.cs
72-
gmcs -r:lib/bin/RabbitMQ.Client.dll Worker.cs
73-
74-
MONO_PATH=lib/bin mono NewTask.exe
75-
MONO_PATH=lib/bin mono Worker.exe
34+
dotnet run -p Worker
35+
dotnet run -p NewTask
7636

7737
#### [Tutorial three: Publish/Subscribe](http://www.rabbitmq.com/tutorial-three-dotnet.html)
7838

79-
##### Windows
80-
81-
csc /r:"RabbitMQ.Client.dll" ReceiveLogs.cs
82-
csc /r:"RabbitMQ.Client.dll" EmitLog.cs
83-
84-
ReceiveLogs.exe
85-
EmitLog.exe
86-
87-
##### Linux
88-
89-
gmcs -r:lib/bin/RabbitMQ.Client.dll ReceiveLogs.cs
90-
gmcs -r:lib/bin/RabbitMQ.Client.dll EmitLog.cs
91-
92-
MONO_PATH=lib/bin mono ReceiveLogs.exe
93-
MONO_PATH=lib/bin mono EmitLog.exe
39+
dotnet run -p ReceiveLogs
40+
dotnet run -p EmitLog
9441

9542
#### [Tutorial four: Routing](http://www.rabbitmq.com/tutorial-four-dotnet.html)
9643

97-
##### Windows
98-
99-
csc /r:"RabbitMQ.Client.dll" ReceiveLogsDirect.cs
100-
csc /r:"RabbitMQ.Client.dll" EmitLogDirect.cs
101-
102-
ReceiveLogsDirect.exe
103-
EmitLogDirect.exe
104-
105-
##### Linux
106-
107-
gmcs -r:lib/bin/RabbitMQ.Client.dll ReceiveLogsDirect.cs
108-
gmcs -r:lib/bin/RabbitMQ.Client.dll EmitLogDirect.cs
109-
110-
MONO_PATH=lib/bin mono ReceiveLogsDirect.exe
111-
MONO_PATH=lib/bin mono EmitLogDirect.exe
44+
dotnet run -p ReceiveLogsDirect info
45+
dotnet run -p EmitLogDirect
11246

11347
#### [Tutorial five: Topics](http://www.rabbitmq.com/tutorial-five-dotnet.html)
11448

115-
##### Windows
116-
117-
csc /r:"RabbitMQ.Client.dll" ReceiveLogsTopic.cs
118-
csc /r:"RabbitMQ.Client.dll" EmitLogTopic.cs
119-
120-
ReceiveLogsTopic.exe
121-
EmitLogTopic.exe
122-
123-
##### Linux
124-
125-
gmcs -r:lib/bin/RabbitMQ.Client.dll ReceiveLogsTopic.cs
126-
gmcs -r:lib/bin/RabbitMQ.Client.dll EmitLogTopic.cs
127-
128-
MONO_PATH=lib/bin mono ReceiveLogsTopic.exe
129-
MONO_PATH=lib/bin mono EmitLogTopic.exe
49+
dotnet run -p ReceiveLogsTopic anonymous.info
50+
dotnet run -p EmitLogTopic
13051

13152
#### [Tutorial six: RPC](http://www.rabbitmq.com/tutorial-six-dotnet.html)
13253

133-
##### Windows
134-
135-
csc /r:"RabbitMQ.Client.dll" RPCServer.cs
136-
csc /r:"RabbitMQ.Client.dll" RPCClient.cs
137-
138-
RPCServer.exe
139-
RPCClient.exe
140-
141-
##### Linux
142-
143-
gmcs -r:lib/bin/RabbitMQ.Client.dll RPCServer.cs
144-
gmcs -r:lib/bin/RabbitMQ.Client.dll RPCClient.cs
145-
146-
MONO_PATH=lib/bin mono RPCServer.exe
147-
MONO_PATH=lib/bin mono RPCClient.exe
148-
54+
dotnet run -p RPCServer
55+
dotnet run -p RPCClient
File renamed without changes.

dotnet/RPCClient/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}
File renamed without changes.

dotnet/RPCServer/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}
File renamed without changes.

dotnet/Receive/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}
File renamed without changes.

dotnet/ReceiveLogs/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}

dotnet/ReceiveLogsDirect.cs renamed to dotnet/ReceiveLogsDirect/ReceiveLogsDirect.cs

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

66
class ReceiveLogsDirect
77
{
8-
public static void Main(string[] args)
8+
public static int Main(string[] args)
99
{
1010
var factory = new ConnectionFactory() { HostName = "localhost" };
1111
using(var connection = factory.CreateConnection())
@@ -19,8 +19,7 @@ public static void Main(string[] args)
1919
Console.Error.WriteLine("Usage: {0} [info] [warning] [error]", Environment.GetCommandLineArgs()[0]);
2020
Console.WriteLine(" Press [enter] to exit.");
2121
Console.ReadLine();
22-
Environment.ExitCode = 1;
23-
return;
22+
return 1;
2423
}
2524

2625
foreach(var severity in args)
@@ -42,6 +41,7 @@ public static void Main(string[] args)
4241

4342
Console.WriteLine(" Press [enter] to exit.");
4443
Console.ReadLine();
44+
return 0;
4545
}
4646
}
4747
}

dotnet/ReceiveLogsDirect/project.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"buildOptions": {
4+
"debugType": "portable",
5+
"emitEntryPoint": true
6+
},
7+
"dependencies": {},
8+
"frameworks": {
9+
"netcoreapp1.0": {
10+
"dependencies": {
11+
"Microsoft.NETCore.App": {
12+
"type": "platform",
13+
"version": "1.0.0"
14+
},
15+
"RabbitMQ.Client": "4.0.*"
16+
},
17+
"imports": "dnxcore50"
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)
0