Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The "ResolveLibraryProjectImports" task failed unexpectedly

I have a Xamarin project, which is based on MvvmCross. The project is for both iOS and Android. I opened this project in Visual Studio 15. I got some errors, which I solved in no time. There are some errors, which are stuck and I couldn't solve them even after searching on Google and on Stackoverflow. I have tried each and every method found on Stackoverflow, but still all remaining errors are there. This project is using 3rd party libraries like RestSharp and BoxApi.V2 (few more)

I am posting my error log below.

Severity    Code    Description Project File    Line    Suppression State Error       The "ResolveLibraryProjectImports" task failed unexpectedly. System.IO.FileNotFoundException: Could not load assembly 'RestSharp(Android), Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'RestSharp(Android).dll'    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() BoxApi.V2 (Android) 

This error is repeating for all projects included in this solution. So I am getting this error multiple times.

I also want to add that the project was previously built on MAC and I am using windows, does this make some compatibility or cross OS issue? I have checked all assembly references and all are working fine.

like image 458
Zaeem Sattar Avatar asked Apr 24 '17 09:04

Zaeem Sattar


2 Answers

I've literally just had this with a brand new Xamarin.Forms application in Visual Studio 2017.

The root cause appears to be that I let VS2017 create the project in it's default location 'C:\Users\Dave\Documents\Visual Studio 2017\Projects' and this has resulted in one of more files now having a path which it too long.

I moved the solution to the root of my D drive and it builds without any problem.

like image 106
DilbertDave Avatar answered Sep 23 '22 11:09

DilbertDave


Your issue is most likely linked to this post on the Xamarin forums, and this bugzilla entry. Without a reproducible sample, all I can advise you try is:

  • Updating Xamarin for Visual Studio, Xamarin.Android, and Xamarin.iOS to the latest stable versions
  • Cleaning and rebuilding
  • Deleting all of the bin and obj folders from your project directories
  • Restarting Visual Studio/your PC

Failing all of that, there's not likely to be anyone who can help you without a reproducible sample and potentially your Xamarin logs.

like image 23
Luke Pothier Avatar answered Sep 25 '22 11:09

Luke Pothier