I am on Ubuntu 17.x 64-bit and I am trying to compile my proto files to C# stubs.
First I install protoc:
wget https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip
unzip protoc-3.5.1-linux-x86_64.zip
sudo cp -r bin include /usr/local/
Then clone the googleapis which some of my proto files depend on:
cd /home/ndipiazza/lucidworks
git clone https://github.com/googleapis/googleapis
Now run the protoc:
protoc -I/home/ndipiazza/googleapis -I/usr/local/include -I. --csharp_out=/home/ndipiazza/Projects/FusionConnectors/FusionConnectors *.proto connector/*
connector-service.proto: warning: Import service-registry-service.proto but not used.
plugin-manager-service.proto: warning: Import google/protobuf/timestamp.proto but not used.
plugin-manager-service.proto: warning: Import property-map.proto but not used.
Generates the stubs.
I tried loading every dependency I could think of:
CSharpTest.Net.RpcLibrary.14.327.1832.1051
Google.Apis.1.21.0
Google.Apis.Auth.1.21.0
Google.Apis.Core.1.21.0
Google.Protobuf.3.5.1
Google.ProtocolBuffers.2.4.1.521
Google.ProtocolBuffers.Rpc.14.1218.1914.1097
Grpc.1.8.3
Grpc.Auth.1.8.3
Grpc.Core.1.8.3
grpc.dependencies.openssl.redist.1.0.2.2
grpc.dependencies.zlib.redist.1.2.8.9
grpc.native.csharp.0.13.1
grpc.native.csharp_ext.0.10.1
Grpc.Tools.1.8.3
Newtonsoft.Json.7.0.1
System.Interactive.Async.3.1.1
Zlib.Portable.Signed.1.11.0
But I cannot seem to find the dependency that adds Google.Rpc.Status.
For example, this code:
public const int StatusFieldNumber = 1;
private static readonly pb::FieldCodec<global::Google.Rpc.Status> _repeated_status_codec
= pb::FieldCodec.ForMessage(10, global::Google.Rpc.Status.Parser);
private readonly pbc::RepeatedField<global::Google.Rpc.Status> status_ = new pbc::RepeatedField<global::Google.Rpc.Status>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::Google.Rpc.Status> Status {
get { return status_; }
}
Produces this error:
/home/ndipiazza/Projects/FusionConnectors/FusionConnectors/ConnectorService.cs(46,46): Error CS0234: The type or namespace name 'Rpc' does not exist in the namespace 'Google' (are you missing an assembly reference?) (CS0234) (FusionConnectors)
/home/ndipiazza/Projects/FusionConnectors/FusionConnectors/ConnectorService.cs(59,59): Error CS0234: The type or namespace name 'Rpc' does not exist in the namespace 'Google' (are you missing an assembly reference?) (CS0234) (FusionConnectors)
/home/ndipiazza/Projects/FusionConnectors/FusionConnectors/ConnectorService.cs(56,56): Error CS0234: The type or namespace name 'Rpc' does not exist in the namespace 'Google' (are you missing an assembly reference?) (CS0234) (FusionConnectors)
/home/ndipiazza/Projects/FusionConnectors/FusionConnectors/ConnectorService.cs(27,27): Error CS0234: The type or namespace name 'Rpc' does not exist in the namespace 'Google' (are you missing an assembly reference?) (CS0234) (FusionConnectors)
/home/ndipiazza/Projects/FusionConnectors/FusionConnectors/ConnectorService.cs(28,28): Error CS0234: The type or namespace name 'Rpc' does not exist in the namespace 'Google' (are you missing an assembly reference?) (CS0234) (FusionConnectors)
/home/ndipiazza/Projects/FusionConnectors/FusionConnectors/ConnectorService.cs(27,27): Error CS0234: The type or namespace name 'Rpc' does not exist in the namespace 'Google' (are you missing an assembly reference?) (CS0234) (FusionConnectors)
/home/ndipiazza/Projects/FusionConnectors/FusionConnectors/ConnectorService.cs(28,28): Error CS0234: The type or namespace name 'Rpc' does not exist in the namespace 'Google' (are you missing an assembly reference?) (CS0234) (FusionConnectors)
Do I have to somehow generate these myself?
ah found it. The missing nuget package was: Google.Api.Gax.Grpc
kept searching for googleapi (no string match) and grpc (too generic, tons of results). Google search helped me by searching for googleapis grpc nuget
I'm not sure what gax stands for.
Google.Api.CommonProtos is enough to satisfy library dependency in generated protoc's code.
Most helpful comment
Google.Api.CommonProtosis enough to satisfy library dependency in generatedprotoc's code.