• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1gRPC in 3 minutes (C#)
2========================
3
4BACKGROUND
5-------------
6This is a different version of the helloworld example, using the old-style .csproj
7files supported by VS2013 and VS2015 (and older versions of mono).
8You can still use gRPC with the old-style .csproj files, but [using the new-style
9.csproj projects](../helloworld/README.md) (supported by VS2017 and dotnet SDK) is recommended.
10
11For this sample, we've already generated the server and client stubs from [helloworld.proto][].
12
13Example projects depend on the [Grpc](https://www.nuget.org/packages/Grpc/), [Grpc.Tools](https://www.nuget.org/packages/Grpc.Tools/)
14and [Google.Protobuf](https://www.nuget.org/packages/Google.Protobuf/) NuGet packages
15which have been already added to the project for you.
16
17PREREQUISITES
18-------------
19
20- Windows: .NET Framework 4.5+, Visual Studio 2013 or 2015
21- Linux: Mono 4+, MonoDevelop 5.9+
22- Mac OS X: Xamarin Studio 5.9+
23
24BUILD
25-------
26
27- Open solution `Greeter.sln` with Visual Studio, Monodevelop (on Linux) or Xamarin Studio (on Mac OS X)
28
29# Using Visual Studio
30
31* Build the solution (this will automatically download NuGet dependencies)
32
33# Using Monodevelop or Xamarin Studio
34
35The nuget add-in available for Xamarin Studio and Monodevelop IDEs is too old to
36download all of the nuget dependencies of gRPC.
37
38Using these IDEs, a workaround is as follows:
39* Obtain a nuget executable for your platform and update it with
40 `nuget update -self`.
41* Navigate to this directory and run `nuget restore`.
42* Now that packages have been restored into their proper package folder, build the solution from your IDE.
43
44Try it!
45-------
46
47- Run the server
48
49  ```
50  > cd GreeterServer/bin/Debug
51  > GreeterServer.exe
52  ```
53
54- Run the client
55
56  ```
57  > cd GreeterClient/bin/Debug
58  > GreeterClient.exe
59  ```
60
61You can also run the server and client directly from the IDE.
62
63On Linux or Mac, use `mono GreeterServer.exe` and `mono GreeterClient.exe` to run the server and client.
64
65Tutorial
66--------
67
68You can find a more detailed tutorial in [gRPC Basics: C#][]
69
70[helloworld.proto]:../../protos/helloworld.proto
71[gRPC Basics: C#]:https://grpc.io/docs/tutorials/basic/csharp.html
72