【发布时间】:2020-09-28 09:00:03
【问题描述】:
在一个 .NET Core 3.0 项目中,我已经安装了Google.Protobuf.Tools,
<PackageReference Include="Google.Protobuf" Version="3.10.0" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.10.0" />
protoc 二进制文件是预期的,
C:\Users\jdphe>dir %USERPROFILE%\.nuget\packages\google.protobuf.tools\3.10.0\tools\windows_x64
Volume in drive C has no label.
Volume Serial Number is 967E-3D8C
Directory of C:\Users\jdphe\.nuget\packages\google.protobuf.tools\3.10.0\tools\windows_x64
10/14/2019 07:36 PM <DIR> .
10/14/2019 07:36 PM <DIR> ..
10/02/2019 06:08 PM 3,611,120 protoc.exe
1 File(s) 3,611,120 bytes
2 Dir(s) 152,718,581,760 bytes free
但是,当尝试在我的 csproj 中使用 <Generator> 标记调用 protoc 时,
<None Update="Person.proto">
<Generator>$(NugetPackageRoot)google.protobuf.tools\3.10.0\tools\windows_x64\protoc.exe --csharp_out=Model Person.proto</Generator>
</None>
找不到生成器“C:\Users\jdphe.nuget\packages\google.protobuf.tools\3.10.0\tools\windows_x64\protoc.exe --csharp_out=Model Person.proto”。请验证名称。
我已验证该命令在命令行的项目文件夹中按预期运行,
C:\Users\jdphe\source\repos\Phenix.Protobufconcat\Phenix.Protobufconcat> %USERPROFILE%.nuget\packages\google.protobuf.tools\3.10.0\tools\windows_x64\protoc.exe --csharp_out =Model Person.proto
我可能不明白<Generator> 标签应该如何工作,但我不确定。
【问题讨论】:
标签: c# .net-core protocol-buffers