ResolveLibraryProjectImports failed - prevents Android project compiling (VS2017 RC)

DevologyDevology GBMember ✭✭

This project works on my Mac, using Xamarin Studio, but when loaded in Visual Studio 2017 RC I receive the following errors...

Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.   nativeapp.Droid     1   Active

and

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

I followed some instructions about running the IDE in debug mode and extracted the FAILED sections...

    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018: The "ResolveLibraryProjectImports" task failed unexpectedly.
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018: System.IO.FileNotFoundException: Could not load assembly 'nativeapp, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018: File name: 'nativeapp.dll'
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
  Done executing task "ResolveLibraryProjectImports" -- FAILED.
Done building target "_ResolveLibraryProjectImports" in project "nativeapp.Droid.csproj" -- FAILED.

Done building project "nativeapp.Droid.csproj" -- FAILED.

And ...

Build FAILED.

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018: The "ResolveLibraryProjectImports" task failed unexpectedly.
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018: System.IO.FileNotFoundException: Could not load assembly 'nativeapp, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018: File name: 'nativeapp.dll'
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1056,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
    0 Warning(s)
    1 Error(s)

My project consists of

common (PCL)
nativeapp.Droid (Android Xamarin.Forms)
nativeapp.iOS (iOS Xamarin.Forms)
nativeapp.Mac (Mac - not currently implemented)
nativeapp.UITests (not much here yet)
nativeapp.xamarinforms (PCL)

Initially I had errors that certain nuget packages could not be found, but that seemed to resolve itself after a little while, but now I'm stuck on the Droid project (I haven't tried iOS yet).

From Help->About

Microsoft Visual Studio Community 2017 RC
Version 15.0.25920.0 D15REL
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Community

Visual Basic 2017 RC   00369-50000-00000-AA220
Microsoft Visual Basic 2017 RC

Visual C# 2017 RC   00369-50000-00000-AA220
Microsoft Visual C# 2017 RC

Visual C++ 2017 RC   00369-50000-00000-AA220
Microsoft Visual C++ 2017 RC

Visual F# 4.1   00369-50000-00000-AA220
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.3.01031.3
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2016   15.0.21108.0
ASP.NET and Web Tools 2016

ASP.NET Web Frameworks and Tools 2013   5.2.41027.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v2.9.6   15.0.21107.0
Azure App Service Tools v2.9.6

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.2.2250.0
Microsoft Azure Data Lake Tools for Visual Studio

Command Bus, Event Stream and Async Manager   Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.

Common Azure Tools   1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GitHub.VisualStudio   1.0
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

KofePackagePackage Extension   1.0
KofePackagePackage Visual Studio Extension Detailed Info

Microsoft Azure Hive Query Language Service   2.2.2250.0
Language service for Hive query

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio vNext - v2.9.41028.1

Microsoft Continuous Delivery Tools for Visual Studio   0.1
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

SQL Server Data Tools   15.1.61101.0
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TSCPackage Extension   1.0
TSCPackage Visual Studio Extension Detailed Info

TypeScript   2.1.2.0
TypeScript tools for Visual Studio

Visual Studio Tools for Apache Cordova   15.108.00.01
Visual Studio Tools for Apache Cordova

Visual Studio Tools for Unity   2.8.0.0
Visual Studio Tools for Unity

Visual Studio Tools for Universal Windows Apps   15.0.25904.02
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.3.0.241 (290c061)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   7.0.99.160 (23ad1d8)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   10.4.0.1 (7c50b27)
Visual Studio extension to enable development for Xamarin.iOS.

Answers

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai
    edited December 2016

    When these messages appear as warnings (which is how they appear at the top of the first post in this thread), that is due to an old bug (Bug 23210) that by coincidence I refreshed just yesterday in a new bug report:

    • Bug 50914 - Unlike other C# project types, Xamarin.Android projects show warning ""ResolveLibraryProjectImports" task failed unexpectedly" and lack some IntelliSense features unless all referenced dependencies have been built

    Note that these warnings are fine to ignore. The problem is just that you'll be missing some IntelliSense features unless you use a workaround.

    Possible workarounds

    (a) Explicitly build all of the dependencies of the Android app project. In this case you would need to build the "nativeapp" project.

    OR

    (b) If you want, you could try making a backup copy and then modifying the "C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets" file as described at the bottom of Bug 50914, Comment 1. To reiterate the caution that's mentioned in the bug report, there is a chance this change might lead to some other issues such as IntelliSense errors after adding new Resource files.

  • DevologyDevology GBMember ✭✭

    Thanks - I see what you mean @BrendanZagaeski, that first entry explicitly shows them being warnings and therefore it shouldn't stop me compiling, however, the trace debug log shows it as an error and in the 'Error List' panel it shows multiple errors.

    (1) CS0103 The name 'InitializeComponent' does not exist in the current context (x 4)
    (2) The "ResolveLibraryProjectImports' task failed unexpectedly (x 1) - Note it's an ERROR
    (3) The installed Xamarin.iOS (version 10.3) on the Mac ... not compatible with the local Xamarin.iOS 10.4'

    (1) Within Xamarin Studio I'm used to seeing InitializeComponent showing up in Intellisense as being problematic, but I can ignore them, whereas in Visual Studio 2017RC it seems to be a compilation error.

    (2) ResolveLibraryProjectsImports is explicitly showing an error

    (3) You'll see from the screenshot that I have the nativeapp.Droid project set as the startup project, so I'm not sure why it's caring about the iOS version anyway.

    Could it be that I can change the severity of these to warnings, or is this something quirky with VS 2017 RC ?

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    If by chance the InitializeComponent errors really are build-time errors (and not just IntelliSense errors) in your current project, then those errors are the primary problem, and the "ResolveLibraryProjectsImports" error is just a side-effect.

    The "ResolveLibraryProjectsImports" message means that the ResolveLibraryProjectsImports Task could not find the .dll for one of the Xamarin.Android project dependencies. When that happens during a background "design-time" build for IntelliSense, it is displayed in the Error List as a warning (as in the first post in the thread) and is usually caused by Bug 50914 (which has some possible workarounds as mentioned in the earlier comment). When it happens during a normal "full" build, it is displayed in the Error List as an error and usually indicates that there was an actual build error in one of the dependencies.

    In case it's helpful additional context, there is a separate bug report filed to request that the non-standard "ResolveLibraryProjectsImports" error message be changed to match the standard error message that other C# projects emit when one of the dependent .dll files is missing: "Metadata file '... .dll' could not be found".

Sign In or Register to comment.