Creating gRPC clients
If you’re using Visual Studio 2022, you can take advantage of its built-in support to add a gRPC client. From Solution Explorer, select the project, open the context menu, and select Add | Connected Service. This opens the dialogue shown in Figure 14.2:
Figure 14.2 – Add service reference
Select gRPC and click Next. This opens the dialogue shown in Figure 14.3:
Figure 14.3 – Add new gRPC service reference
Select the Protobuf file, then select Client from the Select the type of class to be generated dropdown to create the classes for messages and the code for the client.
If you’re not using Visual Studio, you can use a .NET command-line tool called dotnet
. To install this tool, run the following command:
dotnet tool install -g dotnet-grpc
With this tool globally installed, you can use the dotnet-grpc
command to create the proxy classes for the game-apis
client:
cd...