1.创建一个4.5以上project。
2.使用nuget安装Google.ProtoBuf,也可手动引用Google.Protobuf.dll。
3.转换proto文件为cs文件,使用nuget安装Google.Protobuf.Tools。
(新版本的protogen 只支持proto2,不支持proto3)
proto文件如下:
// [START declaration]
syntax = "proto3";
package BASE;
// [END declaration]
// [START messages]
message DatabaseInfo
{
string szDbName =1;
string szDbIP =