Visual Studio 2010 中的 C# 编译错误(Thrift 0.9.1 编译)

标签 c# visual-studio-2010 compilation thrift

我从这里下载了 Apache Thrift 0.9.1:http://wiki.apache.org/thrift/ThriftUsageCSharp 。在 Visual Studio 2010 中,我打开了 thrift/lib/csharp/src 中的 .sln 文件。

但是,我无法构建解决方案。我收到此错误:

Error   3   The command "rmdir /s /q "C:\Users\RS88517\Documents\Visual Studio 2010\Projects\thrift-0.9.1\lib\csharp\test\ThriftTest\gen-csharp"
del /f /q "C:\Users\RS88517\Documents\Visual Studio 2010\Projects\thrift-0.9.1\lib\csharp\test\ThriftTest\ThriftImpl.dll"
SET OUTPUT_DIR=C:\Users\RS88517\Documents\Visual Studio 2010\Projects\thrift-0.9.1\lib\csharp\test\ThriftTest\
SET THRIFT_FILE=C:\Users\RS88517\Documents\Visual Studio 2010\Projects\thrift-0.9.1\lib\csharp\test\ThriftTest\\..\..\..\..\test\ThriftTest.thrift
for %%I in ("%OUTPUT_DIR%") do set SHORT_DIR=%%~fsI
for %%I in ("%THRIFT_FILE%") do set THRIFT_SHORT=%%~fs
"C:\Users\RS88517\Documents\Visual Studio 2010\Projects\thrift-0.9.1\lib\csharp\test\ThriftTest\\..\..\..\..\compiler\cpp\thrift.exe" --gen csharp -o %SHORT_DIR% %THRIFT_SHORT%
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /t:library /out:"C:\Users\RS88517\Documents\Visual Studio 2010\Projects\thrift-0.9.1\lib\csharp\test\ThriftTest\ThriftImpl.dll" /recurse:"C:\Users\RS88517\Documents\Visual Studio 2010\Projects\thrift-0.9.1\lib\csharp\test\ThriftTest\gen-csharp"\* /reference:"C:\Users\RS88517\Documents\Visual Studio 2010\Projects\thrift-0.9.1\lib\csharp\test\ThriftTest\..\..\src\bin\Debug\Thrift.dll"" exited with code 1.

我查了很多地方,但不知道该怎么做。

最佳答案

这是 ThriftTest 的预构建步骤项目。如果您遇到问题,并且可能难以调试,请按以下步骤操作:

  1. 从 C# 项目中完全删除预构建步骤(“项目属性”对话框、“构建事件”选项卡)

  2. 编译\lib\csharp\src\Thrift.csproj生成 Thrift 运行时程序集。或者,考虑包括 Thrift.csproj项目到解决方案中,这使其更易于处理。

  3. 打开命令行,导航到相应的文件夹并调用 thrift.exe --gen csharp ThriftTest.thrift从 IDL 生成代码。这将生成一个新文件夹 gen-csharp里面有一堆文件。 ThriftTest.thrift IDL 文件位于 \test文件夹。

  4. 确保第 3 步生成的文件包含在 ThriftTest 中项目

  5. 构建一切

请注意,对于步骤 3,您的路径中需要 Thrift 编译器 ( thrift.exe )。该文件可在 Apache Thrift 上以预编译形式下载。网站,您不需要自己构建它。

关于Visual Studio 2010 中的 C# 编译错误(Thrift 0.9.1 编译),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21587567/

相关文章:

c# - 使用控制台应用程序 .NET Core 在 C# 中并行运行两个 dotnet 进程

c# - 继承文字字符串问题的构造函数

c# - 连接字符串问题

ios - 如何确定我的 iOS 应用程序正在 DEBUG 模式下运行?

c++ - 代码块 "It seems like project has not been built yet. Do you want to build it now?"

c# - 从中心和半径创建一个 SqlGeography 多边形圆

c# - 访问字典中对象的属性

visual-studio-2010 - 调试使用 Microsoft Azure 服务的 Windows CE 应用程序

visual-studio-2010 - 删除 TFS 分支而不下载它

python - 在 Python 脚本中的 Windows 中的 C++ 命令行编译