xamarin git pull nuget package error



我是Xamarin android开发的新手。

我从 git 中提取代码。

之后,我在Visual Studio中打开了我的解决方案。

我清洁了溶液 - 现在很好。

然后我尝试构建解决方案,它显示错误。

>Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
NuGet Package restore failed for project app: Unable to find version '2.0.0' of package 'FastAndroidCamera'.
C:Program Files (x86)Microsoft SDKsNuGetPackages: Package 'FastAndroidCamera.2.0.0' is not found on source 'C:Program Files (x86)Microsoft SDKsNuGetPackages'.
https://api.nuget.org/v3/index.json: Unable to load the service index for source https://api.nuget.org/v3/index.json.
An error occurred while sending the request.
The remote name could not be resolved: 'api.nuget.org'
1>------ Rebuild All started: Project: app, Configuration: Debug Any CPU ------
1>D:PRANAVTOLLGITMobileApp-12-06-2018MobileAppappapp.csproj(467,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..packagesXamarin.Build.Download.0.4.3buildXamarin.Build.Download.props.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

这是我得到的错误.所以伙计们你能弄清楚我在哪里犯错吗?

根据错误消息,

若要防止 NuGet 在生成期间还原包,请打开视觉对象 Studio 选项对话框中,单击"包管理器"节点并取消选中 "允许 NuGet 在生成期间下载缺少的包。">

该项目似乎使用较旧的现已弃用的 NuGet 包还原,该还原基于 MSBuild 并在每个生成上运行NuGet.exe。这些消息来自NuGet.exe

在此处查看类似问题。

若要解决此问题,应确保升级到最新版本的 NuGet,该版本会自动执行包还原,而不是基于 MSBuild 的 NuGet 包还原。

你将需要删除 NuGet 目标(删除.nuget文件夹,然后手动编辑.csproj文件并删除导入NuGet.targets文件的行(。不再需要这样做。使用新的方法来还原 nuget 包,NuGet 包将在生成之前由 Visual Studio 自动还原。

有关更多信息,请参阅David Ebbo的这篇文章:http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html 和博客如何从"启用包还原"切换到"自动包还原">

希望这有帮助。

最新更新