从sample.proto
package Busy.Proto;
option optimize_for = SPEED;
message BusyRequest { required string message = 1;}
message BusyResponse {required string message = 1;}
service BusyService {rpc Send (BusyRequest) returns (BusyResponse);}
.cs
在包管理器控制台中通过以下命令生成文件
ProtoGen.exe sample.proto -output_directory="C:\SomeDir"
结果sample.cs
文件
// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT!
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.ProtocolBuffers;
...
#region Services
/*
* Service generation is now disabled by default, use the following option to enable:
* option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
*/
#endregion
...
试过了
ProtoGen.exe sample.proto -output_directory="C:\SomeDir" option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
在包管理器控制台中运行。以错误结束
术语“google.protobuf.csharp_file_options”未被识别为名称..
- 加入。
option service_generator_type = GENERIC;
_sample.proto
以错误结束
无法解析符号
如何启用Services
生成?