当 Visual Studio 有效时,MSBuild 无法构建解决方案

MSBuild cannot build a solution when Visual Studio works

我试图在我的小 github 存储库中添加 CI 支持,因此我将其配置为使用 appveyor。但它无法构建我的解决方案并且因奇怪的错误而失败。但它有一个构建日志,所以我在我的控制台中重新输入它们并遇到完全相同的问题,多个奇怪的错误,如 The type or namespace name 'System' could not be found

git clone -q --branch=master https://github.com/Pzixel/RemoteClient.git C:\projects\remoteclient
msbuild "C:\projects\remoteclient\RemoteClient\RemoteClient.sln" /verbosity:minimal

在 AppVeyor 中也是如此:https://ci.appveyor.com/project/Pzixel/remoteclient

然而 VS2017 就可以了:

为什么会发生这种情况,如何解决?

我认为您需要在构建解决方案之前恢复您的 nuget 包。您可以下载 nuget.exe here.

你做不到运行:

nuget restore RemoteClient.sln
msbuild RemoteClient.sln

我做了一个干净的结帐,运行 两个命令。