是否可以使用 TFS 在线恢复带有 Xamarin.iOS 构建的 Nuget 包?

Is it possible to restore Nuget packages with a Xamarin.iOS build using TFS online?

我正在尝试使我的 Xamarin.iOS 应用程序的构建过程自动化。我已经设法在我的网站 Windows 构建代理上找到 Xamarin.AndroidUWP 构建工作。

我现在正在尝试使用我的现场 Mac 构建代理构建一个 Xamarin.iOS 应用程序。

我已将 Restore Nuget 包添加为此构建定义中的第一步,但不断收到错误消息:

MSBuild auto-detection: using msbuild version '4.0' from '/Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/4.5'. MsBuild.exe does not exist at '/Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/4.5/msbuild.exe'. Error: /usr/local/bin/nuget failed with return code: 1 Return code: 1

但我不确定它在 nuget 安装程序阶段试图做什么。

这可以吗?

非Windows 操作系统上的 nuget restore 命令存在一个已知问题:

Restore - Restore works with packages.config and project.json files but will not yet work with *.sln solution files

因此您可以尝试更新“恢复 Nuget 包”步骤以恢复 packages.config 文件而不是解决方案文件。如果还是不行,请尝试将“安装类型”从“还原”更改为“安装”。

NuGet 3.2

With NuGet 3.2, the following commands have been tested to work:

Config

Delete Help Install List Push SetApiKey Sources Spec

参考这个link了解详情:NuGet Compatibility

我遇到了类似的问题。我的日志说:

Unable to find version '2.1.0' of package 'Acr.Support'.
[error]Error: /usr/local/bin/nuget failed with return code: 1

在对日志进行一些挖掘之后,我尝试在我的本地 mac 上恢复 nuget 包。我打开终端并输入:

sudo cd /usr/local/bin

[enter password]

您的 nuget 可执行文件应该位于此处。 我执行了:

nuget

查看我的 nuget 版本,它是 2.12.0.0 我注意到这是一个旧版本,所以我更新了它:

sudo su [enter password] nuget update -self

我注意到它更新到 3.4.4 rtm final,我再次启动了我的 Visual Studio 在线流程并且成功了!希望这对任何人都有帮助。