'import google/protobuf/timestamp.proto was not found or had errors in windows
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;
}
Solution 1:[1]
This error is coming, because we are executing protoc compiler by selecting incorrect addreess.
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 path C:\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
protoc -I="C:\Users\manishkumar\source\repos\protobuf_consoleApp" --csharp_out="C:\Users\manishkumar\source\repos\protobuf_consoleApp" "C:\Users\manishkumar\source\repos\protobuf_consoleApp\proto\*.proto"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Manish |




