导入Google/protobuf/timestamp.proto在Windows中找不到或有错误
我正在尝试使用.proto文件生成C#代码,但是获得错误
导入Google/protobuf/timestamp.proto 没有找到或有错误。视窗
syntax = "proto3";
option csharp_namespace = "icigcppubsub1";
import "google/protobuf/timestamp.proto";
message SomeMessage {
message Itemkey {
string itemType = 1;
string itemNo = 2;
}
message Locale {
string countryCode = 1;
string languageCode = 2;
}
message Names {
Locale locale = 1;
string itemName = 2;
string presentationGroupCode = 3;
string measurementSystem = 4;
google.protobuf.Timestamp sourceInsertDateTime = 5;
google.protobuf.Timestamp sourceUpdateDateTime = 6;
}
Itemkey itemKey = 1;
repeated Names names = 2;
}
I am trying to generate C# code using .proto file, but getting error
import google/protobuf/timestamp.proto was not found or had errors. windows
syntax = "proto3";
option csharp_namespace = "icigcppubsub1";
import "google/protobuf/timestamp.proto";
message SomeMessage {
message Itemkey {
string itemType = 1;
string itemNo = 2;
}
message Locale {
string countryCode = 1;
string languageCode = 2;
}
message Names {
Locale locale = 1;
string itemName = 2;
string presentationGroupCode = 3;
string measurementSystem = 4;
google.protobuf.Timestamp sourceInsertDateTime = 5;
google.protobuf.Timestamp sourceUpdateDateTime = 6;
}
Itemkey itemKey = 1;
repeated Names names = 2;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原因
产生了误差,因为原始可执行文件期望其库在特定位置(在同一文件夹或.. \ include)中。
解决方案
按照以下步骤。
步骤1。在包装下安装。
步骤2
。 ://i.sstatic.net/eco78.png“ alt =”显示Google..protobuf.tools executable2“>
步骤3。 >文件夹路径下方的文件
C:\Users\manishkumar\.nuget\packages\google.protobuf.tools\3.20.1\tools\windows_x64
and Paste to
C:\Users\manishkumar.ma\.nuget\软件包\ google.protobuf.tools \ 3.20.1 \工具
步骤4。更改命令提示中的执行路径。
步骤5
。 >
Reason
The error is produced because the protoc executable expects its libraries in particular locations (in the same folder, or in the ..\include).
Solution
Follow the following steps.
STEP 1. Install below package.
STEP 2. Copy the Path of
Google.Protobuf.Tools
[
STEP 3. Copy the
protoc.exe
file from below folder pathC:\Users\manishkumar\.nuget\packages\google.protobuf.tools\3.20.1\tools\windows_x64
and Paste to
C:\Users\manishkumar.ma\.nuget\packages\google.protobuf.tools\3.20.1\tools
STEP 4. Change Execution path in command prompt.
STEP 5. Execute below command using .proto file