Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 1 | gRPC in 3 minutes (C#) |
| 2 | ======================== |
| 3 | |
| 4 | BACKGROUND |
| 5 | ------------- |
| 6 | For this sample, we've already generated the server and client stubs from `helloworld.proto`. |
| 7 | Example projects depend on NuGet packages `Grpc` and `Google.ProtocolBuffers` which have been already added to the project for you. |
| 8 | |
| 9 | PREREQUISITES |
| 10 | ------------- |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 11 | **Windows** |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 12 | - .NET 4.5+ |
| 13 | - VS 2013 (with NuGet plugin installed) |
| 14 | |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 15 | **Linux (Mono)** |
| 16 | - Mono |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 17 | - Monodevelop 5.9 with NuGet Add-in installed (older versions might work) |
| 18 | |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 19 | **MacOS (Mono)** |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 20 | - Xamarin Studio (with NuGet plugin installed) |
| 21 | |
| 22 | BUILD |
| 23 | ------- |
| 24 | |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 25 | **Windows** |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 26 | - Clone this repository. |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 27 | |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 28 | - Open solution `Greeter.sln` with Visual Studio |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 29 | |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 30 | - Build the solution (this will automatically download NuGet dependencies) |
| 31 | |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 32 | **Linux (Mono)** |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 33 | - Clone this repository. |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 34 | |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 35 | - Install gRPC C Core using instructions in https://github.com/grpc/homebrew-grpc |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 36 | |
| 37 | - gRPC C# depends on native shared library `libgrpc_csharp_ext.so`. To make it visible |
| 38 | to Mono runtime, follow instructions in [Using gRPC C# on Linux](https://github.com/grpc/grpc/tree/master/src/csharp#usage-linux-mono) |
| 39 | |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 40 | - Open solution `Greeter.sln` in MonoDevelop (you need to manually restore dependencies by using `mono nuget.exe restore` if you don't have NuGet add-in) |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 41 | |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 42 | - Build the solution. |
| 43 | |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 44 | **MacOS (Mono)** |
| 45 | - See [Using gRPC C# on MacOS](https://github.com/grpc/grpc/tree/master/src/csharp#usage-macos-mono) for more info |
| 46 | on MacOS support. |
| 47 | |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 48 | Try it! |
| 49 | ------- |
| 50 | |
| 51 | - Run the server |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 52 | |
| 53 | ``` |
| 54 | > cd GreeterServer/bin/Debug |
| 55 | > GreeterServer.exe |
| 56 | ``` |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 57 | |
| 58 | - Run the client |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame^] | 59 | |
| 60 | ``` |
| 61 | > cd GreeterClient/bin/Debug |
| 62 | > GreeterClient.exe |
| 63 | ``` |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 64 | |
| 65 | You can also run the server and client directly from Visual Studio. |
| 66 | |
| 67 | On Linux or Mac, use `mono GreeterServer.exe` and `mono GreeterClient.exe` to run the server and client. |
| 68 | |
| 69 | Tutorial |
| 70 | -------- |
| 71 | |
| 72 | You can find a more detailed tutorial in [gRPC Basics: C#](https://github.com/grpc/grpc-common/blob/master/csharp/route_guide/README.md) |