0
votes

I recently updated my Win VS 2017 Xamarin project to Xamarin Forms 2.5.0.212934. I updated some other packages and added Microsoft.AppCenter 1.0.1 at the same time. Dependencies on a number of packages in the Xamarin.Android namespace forced them to update to 26.1.0.1. Now when I build I get the following 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.Android.Support.Vector.Drawable.23.3.0\build\Xamarin.Android.Support.Vector.Drawable.targets."

Apparently a reference to the old version persists. NuGet options in VS are set to automatically check and download packages. I have tried numerous combinations of restore, uninstall, reinstall but cannot resolve this issue. I have searched the project for references to the old version but find none. It is entirely possible I don't know where to look as NuGet package management is still a black hole to me. I believe it is higher than the project level as when I restore my project files from source control to a known good state I get the same error.

Where would I search for this dependency, or is there some way to auto-resolve the it with NuGet that I am missing?

1

1 Answers

2
votes

I was able to resolve this problem, though the root cause is still a mystery. I'll document my resolution in case it is helpful to anyone else in future.

I noticed the path to the 'missing' file was relative and only looked up two directories. For some reason when this project was created (from a VS/Xamarin template) it was placed under a 'src' folder, making the relative path in this error wrong. To test this I copied the missing file to the relative path the error referred to and sure enough the build continued. There were other errors at that point, presumably resulting from the out of place package trying to locate other resources.

To solve the problem I removed the project from my VS solution, moved the project files up one folder and re-added the project to the solution. This resulted in the correct relative paths in all package references and a successful build. My only concern now is that the might be other secret dependencies in the project that I broke unknowingly. Time will tell... really not a fan of NuGet magic right now. Had I been able to find the actual line with the incorrect relative path in a file somewhere I could have fixed it manually.