简体   繁体   English

xamarin git pull nuget包错误

[英]xamarin git pull nuget package error

I am new in Xamarin android development. 我是Xamarin android开发的新手。

I take the code pull from git. 我从git中提取代码。

After that i opened my solution in visual studio. 之后,我在Visual Studio中打开了我的解决方案。

I cleaned the solution - now it is fine. 我清洗了溶液-现在很好。

then i trying to build the solution it is showing the error. 然后我试图建立解决方案,它显示了错误。

>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 SDKs\NuGetPackages\: Package 'FastAndroidCamera.2.0.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
  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:\PRANAV\TOLL\GIT\MobileApp-12-06-2018\MobileApp\app\app.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 ..\packages\Xamarin.Build.Download.0.4.3\build\Xamarin.Build.Download.props.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========\

This is the error that i am getting . 这是我得到的错误。 So guys can you figure where i am doing the mistakes ? 你们能弄清楚我在哪里犯错吗?

According to the error message, 根据错误消息,

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在构建过程中还原软件包,请打开“ Visual Studio选项”对话框,单击“软件包管理器”节点,然后取消选中“允许NuGet在构建过程中下载丢失的软件包”。

It seems the project use the older now deprecated NuGet package restore that is MSBuild based and runs NuGet.exe on every build. 看来该项目使用的是基于MSBuild的,现在已弃用的NuGet较旧的软件包还原,并且在每个版本上都运行NuGet.exe These messages are from NuGet.exe . 这些消息来自NuGet.exe

Check the similar issue here . 这里检查类似的问题。

To resolve this issue, you should make sure to upgrade to the latest version of NuGet which does package restore automatically instead of MSBuild based NuGet package restore. 要解决此问题,您应该确保升级到不会自动还原软件包的NuGet最新版本,而不是基于MSBuild的NuGet软件包还原。

You're going to want to delete the NuGet targets (delete the .nuget folder and then manually edit your .csproj files and remove the lines that import the NuGet.targets file). 您将要删除NuGet目标(删除.nuget文件夹,然后手动编辑.csproj文件,并删除导入NuGet.targets文件的行)。 This is no longer needed. 不再需要。 Using the new way to restore nuget package, the NuGet packages will be automatically restored by Visual Studio just before the build. 使用新的还原nuget软件包的方式,NuGet软件包将在构建之前由Visual Studio自动还原。

See this post by David Ebbo for more information: http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html and the blog how to switch from "Enable Package Restore" to "Automatic Package Restore" 请参阅David Ebbo的这篇文章,了解更多信息: http ://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html和博客如何从“启用程序包还原”切换”到“自动打包还原”

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM