The "ResolveLibraryProjectImports" task failed unexpectedly.

I just installed VS 2017.
Got this warning after creating a cross platform project.

Severity Code Description Project File Line Suppression State
Warning The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'App1, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'App1.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, 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() App1.Android

Posts

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Same as always.
    Create the solution.
    Clean the solution.
    Close the solution
    Re-open the solution so it goes though its Loading... process
    Rebuild the solution.

  • RK1RK1 USMember ✭✭

    thanks

  • kylehumfeldkylehumfeld USMember ✭✭

    So what happens when that doesn't work? Because I tried it, and it didn't.

  • Prajakta.ShindePrajakta.Shinde INUniversity ✭✭

    I am getting this issue for xamarin.android. I tried clean solution, rebuild solution, Deleted bin , obj files too.
    Having same error again and again. Can't proceed further due to this issue. Please help anyone. :s

  • AyaElMoatazAyaElMoataz USMember

    Same here .. We need urgent help please

  • ChrisMacLeanChrisMacLean CAMember ✭✭

    Same problem. Using Visual Studio 2017. Created a new Xamarin Forms PCL project, ran the Nuget updates and try to build and get the 'ResolveLibraryProjectImports' error. Is there an answer for this?

  • cammy_sweetcammy_sweet BRMember

    @ChrisMacLean said:
    SOLUTION: The problem is that if the project is in the default Visual Studio Project directory the name was too long for the Android project. I moved the solution to a different drive which resulted in a shorter name and the error disappeared.

    WORKS!

  • it happened to me too with a fresh new "Hello World" project !!

    >

    Solution::

    Rebuild the project....

    solved!!

  • LynkLynk USMember ✭✭

    Had same problem. Here is my solution

    1. Restart Visual Studio
    2. Open the Project
    3. Clean the solution
    4. Rebuild the solution
    5. Close solution
    6. Reopen the project
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Clean solution
    From the top project downward, build each project - NOT Rebuild the entire solution. Build each project one at a time.
    Delete any deployed copy of the app from your device.
    F5 - Debug (which will deploy)
    Works every time 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, following a few days of hair pulling frustration.

    Hopefully this helps others.

    Cheers,

  • 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.

    1. \<ItemGroup>
    2. {1111XXXX-11XX-1111-XX11-XX11XX11XX11}
    3. MyApp.iOS

    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, following a few days of hair pulling frustration.

    Hopefully this helps others.

    Cheers,

  • 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,

  • CharwakaCharwaka INMember ✭✭✭✭

    In my case Just Unload Reload "Resources" Folder in Xamarin.Android

  • PhenmanPhenman USMember ✭✭
    edited December 2017

    I was try to clean solution, reinstall Xamarin.Forms, delete "bin", "obj" and "packages" folders, relocate solution folder to D:\, but nothing helps. I have been struggling with this problem for 2 days. :s :s This problem is interrelated with "Metadata file {Debug\MyProject.dll} could not be found" problem, because they appearing and disappearing together.

  • CharwakaCharwaka INMember ✭✭✭✭

    Hi @Phenman

    try my solutions here

    c-sharpcorner.com/blogs/the-resolvelibraryprojectimports-task-failed-unexpectedly

    after trying them if didnt solved , try downgrading Xamarin Android Support Packages

  • PhenmanPhenman USMember ✭✭

    @Charwaka said:
    Hi @Phenman

    try my solutions here

    c-sharpcorner.com/blogs/the-resolvelibraryprojectimports-task-failed-unexpectedly

    after trying them if didnt solved , try downgrading Xamarin Android Support Packages

    this link is not work

  • CharwakaCharwaka INMember ✭✭✭✭

    Hi @Phenman

    try this

    This is the most common error in Xamarin ,so if you are facing ResolveLibraryProjectImports task failed unexpectedly go through the  following solutions to fix it
    
    Solution 1
    
    Move your Project to Root Directory
    C:\MyProject
    Clean & Rebuild
    
    Solution 2:
    
    Make sure there are no spaces in the name of Solution Folder 
    
    Solution 3
    Restart Visual Studio
    Open the Project
    Clean the solution
    Rebuild the solution
    Close solution
    Reopen the project
    Solution 4
    
    Delete .suo file which in your solution folder for this you need to show all files options (basically this is a hidden file) 
    
    Solution 5
    
    Exclude and Include Resources Folder in Android Project if you are working on Android Project 
    
    Solution 6
    
    Edit .csproj File add this property
    
    <UseShortFileNames>True</UseShortFileNames>
    
    Solution 7
    
    Try excluding and including files which you added recently to project
    
    Solution 8
    
    Make sure your Xamarin Forms is up to date 
    
    Solution 9
    
    Restart Visual Studio in Admin Mode 
    
    Solution 10
    
    Cloase Visual Studio ->Delete Packages Folder Completely  from solution(open through FileExplorer) and rebuild
    
    Solution 11
    
    Try to Downgrade Android Support Packages and Rebuild
    
    Common Solutions
    
    Delete and Add References which you find suspicious (due to dependency), Delete all the bin and obj folders from your project directories.
    
  • PhenmanPhenman USMember ✭✭

    how to downgrade Android Support Packages? They all depend on each other and do not give you the version below. :s
    I am creating everything anew. If that does not help, I'll probably shoot myself :s :s :s

  • PhenmanPhenman USMember ✭✭

    I had created solution anew, but finally I have the same errors:
    "Metadata could not be found" and "resolvelibraryprjectimports task failed".
    Thanks to Microsoft for the next product with a bunch of bugs that do not fix from year to year.

  • PhenmanPhenman USMember ✭✭

    I had done 7 steps from description of IDE0006.


    I had detected in *designtime.log this errors:

    I think, the problem is in the "styles.xml" file.

    Does anyone know what to do about it?

  • PhenmanPhenman USMember ✭✭

    I had reinstall Visual Studio, but finally I have the same 2 errors.

  • CharwakaCharwaka INMember ✭✭✭✭

    @Phenman said:
    I had reinstall Visual Studio, but finally I have the same 2 errors.

    zip and send me code , i will fix that , make sure to upload to onedrive

  • PhenmanPhenman USMember ✭✭

    @Charwaka said:
    zip and send me code , i will fix that , make sure to upload to onedrive

    ....

    @Charwaka said:
    you didnt Refered NameSpace for Maps "clr-namespace ......." . and some place in viewmodel passing more arguments. and spaces in XAML code

    now it works! Thank's a lot for ** Charwaka**

  • CharwakaCharwaka INMember ✭✭✭✭

    @Phenman said:

    @Charwaka said:
    zip and send me code , i will fix that , make sure to upload to onedrive

    ....

    @Charwaka said:
    you didnt Refered NameSpace for Maps "clr-namespace ......." . and some place in viewmodel passing more arguments. and spaces in XAML code

    now it works! Thank's a lot for ** Charwaka**

    Cool :)

  • DyaryDyary Member ✭✭

    @cammy_sweet said:

    @ChrisMacLean said:
    SOLUTION: The problem is that if the project is in the default Visual Studio Project directory the name was too long for the Android project. I moved the solution to a different drive which resulted in a shorter name and the error disappeared.

    WORKS!

Sign In or Register to comment.