只有当我 运行 它作为使用 PsExec 的远程服务时才编译失败

Compile failure only when I run it as a remote service using PsExec

我正在尝试 运行 在一系列构建机器上编译测试,因此我编写了一个脚本来将作业分发到每台机器。我正在使用来自微软的 PsExec,它在它发出 运行s 命令的构建机器上安装一个服务。在每台构建机器上,我都有一个批处理文件,它调用一个 python 脚本,该脚本 运行 需要所有测试。原始脚本会将什么测试传递给 运行,以及日志信息,以便我可以存储结果并在以后跟踪它。

原脚本可以调用所有机器并正常执行批处理文件。如果我在每台机器上本地 运行 批处理文件,它会正确调用 python 脚本,编译一切正常。但是当我 运行 从原始脚本远程批处理文件时,我得到以下编译错误

fatal error C1902: Program database manager mismatch; please check your installation

一遍又一遍。我在每台机器上使用 Microsoft Visual Studio 12 和 python 2.7。有谁知道为什么仅因为调用 bat 文件的脚本调用 python 脚本才会发生该错误?任何帮助或推动正确的方向将不胜感激!谢谢!

引用MSDN的相关部分

Fatal Error C1902

"...For example, you might have copied the files so you could invoke the compiler or link tool from the command prompt without setting the PATH environment variable accordingly."

因此请确保本地和远程的 PATH 环境变量相同

fatal error C1902: Program database manager mismatch; please check your installation

来自 MSDN 和 Expand Fatal Error C1902

A program database file (.pdb) was created using a newer version of mspdbXX.dll than the one the compiler found on your system. This error usually indicates that mspdbsrv.exe or mspdbcore.dll are missing or have different versions than mspdbXX.dll. (The XX placeholder in the mspdbXX.dll file name changes with each product release. For example, in Visual Studio 2005 the file name is mspdb80.dll.)

Ensure matching versions of mspdbsrv.exe, mspdbcore.dll, and mspdbXX.dll are installed on your system. Ensure that mismatched versions have not been copied to the directory that contains the compiler and link tools for your target platform. For example, you might have copied the files so you could invoke the compiler or link tool from the command prompt without setting the PATH environment variable accordingly.

我在 VS2010 上遇到过这样的错误,除非我使用的是 Cygwin 的 ssh。

问题是 cl.exe 编译器 运行s mspdbsrv.exe 作为中央服务器而不是自己处理调试信息。当您从交互式会话中编译 运行 时,一切正常,但是当 cl.exe 是来自某种远程会话的 运行 时,它无法连接到实际的 mspdbsrv.exe 并最终因 C1902 错误而失败。

似乎尽管 Cygwin ssh 运行s bash (shell) 来自 .\Administrator,但在 RPC API 的某处,其中的帐户使用服务运行s(在我的例子中是.\cyg_server)。这是来自 API 监控跟踪 cl.exe:

的屏幕截图

我已通过将 sshd 服务用户更改为 .\Administrator 设法解决了该问题。您或许可以使用 PsExec 来解决这个问题。