Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 1 | gRPC in 3 minutes (C#) |
| 2 | ======================== |
| 3 | |
| 4 | BACKGROUND |
| 5 | ------------- |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 6 | For this sample, we've already generated the server and client stubs from [helloworld.proto][]. |
| 7 | |
| 8 | Example projects depend on the [Grpc](https://www.nuget.org/packages/Grpc/) |
| 9 | and [Google.Protobuf](https://www.nuget.org/packages/Google.Protobuf/) NuGet packages |
| 10 | which have been already added to the project for you. |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 11 | |
| 12 | PREREQUISITES |
| 13 | ------------- |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 14 | **Windows** |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 15 | - .NET 4.5+ |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 16 | - Visual Studio 2013 or 2015 |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 17 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 18 | **Linux** |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 19 | - Mono |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 20 | - Monodevelop 5.9 with NuGet Add-in installed |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 21 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 22 | **Mac OS X** |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 23 | - Xamarin Studio (with NuGet plugin installed) |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 24 | - [homebrew][] |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 25 | |
| 26 | BUILD |
| 27 | ------- |
| 28 | |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 29 | **Windows** |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 30 | |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 31 | - Open solution `Greeter.sln` with Visual Studio |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 32 | |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 33 | - Build the solution (this will automatically download NuGet dependencies) |
| 34 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 35 | **Linux (Debian)** |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 36 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 37 | - Install gRPC C core and C# native extension using [How to use gRPC C#][] instructions |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 38 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 39 | - Open solution `Greeter.sln` in MonoDevelop. |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 40 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 41 | - Build the solution (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] | 42 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 43 | **Mac OS X** |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 44 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 45 | - Install gRPC C core and C# native extension using [How to use gRPC C#][] instructions |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 46 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 47 | - Open solution `Greeter.sln` with Xamarin Studio |
| 48 | |
| 49 | - Build the solution (this will automatically download NuGet dependencies) |
| 50 | |
| 51 | Try it! |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 52 | ------- |
| 53 | |
| 54 | - Run the server |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 55 | |
| 56 | ``` |
| 57 | > cd GreeterServer/bin/Debug |
| 58 | > GreeterServer.exe |
| 59 | ``` |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 60 | |
| 61 | - Run the client |
Jan Tattermusch | 2fca545 | 2015-05-21 17:46:27 -0700 | [diff] [blame] | 62 | |
| 63 | ``` |
| 64 | > cd GreeterClient/bin/Debug |
| 65 | > GreeterClient.exe |
| 66 | ``` |
Jan Tattermusch | 226af65 | 2015-04-03 16:39:51 -0700 | [diff] [blame] | 67 | |
| 68 | You can also run the server and client directly from Visual Studio. |
| 69 | |
| 70 | On Linux or Mac, use `mono GreeterServer.exe` and `mono GreeterClient.exe` to run the server and client. |
| 71 | |
| 72 | Tutorial |
| 73 | -------- |
| 74 | |
Jan Tattermusch | 3fcbdef | 2015-09-25 11:53:16 -0700 | [diff] [blame] | 75 | You can find a more detailed tutorial in [gRPC Basics: C#][] |
| 76 | |
| 77 | [homebrew]:http://brew.sh |
| 78 | [helloworld.proto]:../../protos/helloworld.proto |
| 79 | [How to use gRPC C#]:../../../src/csharp#how-to-use |
| 80 | [gRPC Basics: C#]:http://www.grpc.io/docs/tutorials/basic/csharp.html |