Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If I copy protos files to my C# project, Import "google/api/annotations.proto" was not found or had errors. #152

Open
forconz opened this issue Sep 15, 2021 · 1 comment
Labels
question Further information is requested

Comments

@forconz
Copy link

forconz commented Sep 15, 2021

🐛 Bug Report

import 的路径要用完整的路径
例如:wechaty\puppet.proto

https://github.com/wechaty/grpc/blob/main/proto/wechaty/puppet.proto
import "wechaty/puppet/base.proto";
import "wechaty/puppet/contact.proto";
import "wechaty/puppet/event.proto";
import "wechaty/puppet/friendship.proto";
import "wechaty/puppet/message.proto";
import "wechaty/puppet/room.proto";
import "wechaty/puppet/room_invitation.proto";
import "wechaty/puppet/room_member.proto";
import "wechaty/puppet/tag.proto";
这个文件在C#项目里会出错,修改成下面,用完整的路径,就不报错了

import "proto/wechaty/Puppet/base.proto";
import "proto/wechaty/Puppet/contact.proto";
import "proto/wechaty/Puppet/event.proto";
import "proto/wechaty/Puppet/friendship.proto";
import "proto/wechaty/Puppet/message.proto";
import "proto/wechaty/Puppet/room.proto";
import "proto/wechaty/Puppet/room_invitation.proto";
import "proto/wechaty/Puppet/room_member.proto";
import "proto/wechaty/Puppet/tag.proto";

To Reproduce

(Write your steps here:)

  1. Copy the protos files from https://github.com/wechaty/grpc to my C# project
  2. 修改csproj文件
3. 生成,building 4.

Expected behavior

编译通过,生成代码

Actual Behavior

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 File not found. Wechat D:\Wechat\google\api\annotations.proto 1
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 File not found. Wechat D:\Wechat\protoc-gen-openapiv2\options\annotations.proto 1
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 Import "google/api/annotations.proto" was not found or had errors. Wechat D:\Wechat\Protos\Wechaty\puppet.proto 26
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 Import "protoc-gen-openapiv2/options/annotations.proto" was not found or had errors. Wechat D:\Wechat\Protos\Wechaty\puppet.proto 27

proto的定义,在C#项目里有点问题,暂时不知道如何修复。

Your Environment

Windows10,vs.net 2019

@huan
Copy link
Member

huan commented Sep 26, 2021

Please refer to our .NET GitHub Action at https://github.com/wechaty/grpc/blob/main/.github/workflows/csharp.yml and I hope it can help you to solve your problem.

CC @wechaty/dotnet

@huan huan added the question Further information is requested label Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants