Error while building solution The ResolveLibraryprojectsImports task failed unexpectecdly

EsritInesEsritInes MXMember ✭✭

Is making me crazy, I have two days with the same error, I already clean the solution like a hundred times, rebuild, and buil, change the directory project, resintall xamarin.forms like 5 times.

When I try to build the solution this error appears: where DemoActivos is the pcl project name

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

Answers

  • Praveen.BPraveen.B INMember ✭✭

    Changing the directory worked for me.

  • AndreCarAndreCar USMember

    For those who may still be plagued with this problem, I discovered a well-hidden cause and a solution that worked in my case. I had the good fortune of having one solution that was not impacted following an upgrade to the latest version of Xamarin and VS 2017. A second solution did not fare as well.

    After trying every solution I could find on the web, I decided to walk through the Android csproj file of the troubled solution, line by line. (To review, “unload” the Android project and “edit” the csproj.) While doing so, I ran across an alarming set of lines. It read similar to the following.

      <ItemGroup>
        <ProjectReference Include="..\MyApp\MyApp.csproj">
          <Project>{1111XXXX-11XX-1111-XX11-XX11XX11XX11}</Project>
          <Name>MyApp.iOS</Name>
        </ProjectReference>
      </ItemGroup>
    

    Why the Android project is referencing the iOS project was confusing—especially when the include parameter suggested the PCL project. The working solution confirmed my suspicions. The Android project should reference the PCL project.

    The solution: “Unload” and “edit” the PCL project. Copy the PCL ProjectGuid listed in the PCL project csproj file. Return to the Android project csproj file and replace the guid listed on line #3 in the XML lines above with the PCL ProjectGuid and delete the “.iOS” on line #4.

    While in the csproj file, I also discovered a few duplicate NuGet package references, in which they were trying to import two versions of the same package. After ensuring NuGet Package Manager lists the latest package versions, I removed lines in the Android csproj file attempting to import older NuGet package versions.

    After reloading the unloaded projects, solution builds were successful, just as they were prior to the Xamarin and VS 2017 upgrade. I was finally back in business

    Hopefully this helps others.

    Cheers,

Sign In or Register to comment.