使用 protobuf-net 获取 ProtoGen [英] Getting ProtoGen with protobuf-net

查看:92
本文介绍了使用 protobuf-net 获取 ProtoGen的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 protobufs 序列化一些类.我使用 NuGet 安装了 protobuf-net,使用属性正确修饰了我的代码,一切运行良好.

I'm trying to serialize some classes with protobufs. I installed protobuf-net using NuGet, properly decorated my code with the attributes, and everything is running great.

但是,最终消息将在 C# 中创建,但在其他环境中使用,因此我需要从 C# 创建 .proto 文件,或者 - 对我来说似乎更合理的 - 从 .proto 文件创建 C# 代码.

However, eventually messages will be created in C#, but consumed in other environments, so I need to either create .proto files from C#, or - what seems more reasonable to me - create C# code from .proto files.

无论我做什么,我都找不到安装在我电脑上的 ProtoGen.exe.我还发现了这篇旧帖子,但是当我创建一个 .proto 文本文件时,没有任何类似的事情发生.手动添加 ProtoBufTool 也不起作用.

No matter what I do, I can't find ProtoGen.exe installed anywhere in my computer. I also found this old post, but nothing of the sort happens when I create a .proto text file. Adding ProtoBufTool manually didn't work, either.

我错过了什么?

推荐答案

Protogen 包含在 v1/280 版本中,或者项目站点提供了单独的 VS 工具.没有一种方便的方法可以以任何明智的方式将其包含在 nuget 中(我与 MS 人员核对过两次).

Protogen is included in the v1/280 build, or there is a separate VS tool available from the project site. There isn't a convenient way to include it in nuget in any sensible way (I checked with MS folks; twice).

对于 protogen 和 VS 插件,v2 的功能没有改变,因此现有的 v1 二进制文件仍然可以用于 v2.

For both protogen and the VS addin, the functionality has not changed for v2, so the existing v1 binaries remain fine for use with v2.

如果 ProtoBufTool 不起作用,那么……我不知道这是怎么回事;是否有任何错误消息/警告?经典警告是关于输入文件的编码(protoc",google 的工具,对编码非常挑剔).

If the ProtoBufTool didn't work then... I don't know what is up with that; was there any error message / warning? The classic warning is about the input file's encoding ("protoc", google's tool, is very fussy about encoding).

这篇关于使用 protobuf-net 获取 ProtoGen的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆