2012-04-26 79 views
0

我试图让协议缓冲区与该protobuf-csharp端口去。我想通过添加.proto文件并使用自定义工具进行自动构建,然后获取.cs文件。对于定制工具,我被要求从CmdTool中取出一个csharp-test包,并注册它。获取自定义生成工具来创建C#文件

这工作,但随后运行该工具,我得到

System.InvalidOperationException: Before a project can be instantiated, Engine.BinPath 
must be set to the location on disk where MSBuild is installed. This is used to evaluate 
$(MSBuildBinPath). 
at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args) 
at Microsoft.Build.BuildEngine.Project..ctor(Engine engine) 
at CSharpTest.Net.CustomTool.VsInterop.CmdTool.GenerateCode(String defaultNamespace, 
    String inputFileName) in e:\Projects\Library\Tools\CmdTool\VsInterop\CustomTool.cs:line 50 

我走出我的元素,而且似乎无法找到任何线索做什么,或者如何获得$(MSBuildBinPath )或Engine.BinPath发生。

或者,即使有一个,不太复杂的方式来获得硫辛酸从F7运行,这将是很好的。

+0

类似的问题:HTTP ://stackoverflow.com/questions/453820/protocol-buffers-in-c-sharp-projects-using-protobuf-net-best-practices-for-cod – heavyd 2012-04-26 22:38:29

+0

如果该问题的接受答案是不安装另一个protobuf/c#解决方案我会很激动。正如我对这个兔子洞有多深深感到懊恼一样。 – 2012-04-27 13:43:08

+0

啊..是的。您是否尝试过查看CmdTool的输出窗口和日志文件? (http://help.csharptest.net/?CmdToolVisualStudio.html) – heavyd 2012-04-27 14:31:00

回答

1

我在Visual Studio 2008年我与工具的作者合作,获得解决方案的确切同样的问题,他的脚步为我工作。

  1. 下载NuGet包 “Csharptest.net.tools”

  2. 运行 “工具/ net40/CmdTool.exe注册”

  3. 重启VStudio