Bug 23334 - Unexpected error : IO.FileNotFound exception
Summary: Unexpected error : IO.FileNotFound exception
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.18.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-09-24 09:43 UTC by OlegY
Modified: 2017-06-28 19:16 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description OlegY 2014-09-24 09:43:54 UTC
While creating a blank project even before compiling :

Warning	1	Unexpected error - Please file a bug report at http://bugzilla.xamarin.com. Reason: System.IO.FileNotFoundException: Could not load assembly 'App5, Version=, Culture=neutral, PublicKeyToken=null'. Perhaps it doesn't exist in the Mono for Android profile?	App5.Android
Comment 1 Sadik Ali 2014-10-01 02:45:12 UTC
I have checked this issue and unable to reproduce it.

I have tried following steps to reproduce it.
1.Create a Xamarin Android  application.
2.Build the application.
3.Run the application.

I observed that application build and deploy successfully.

Let me know if I missed anything to reproduce it.

Screencast regarding Same :
http://screencast.com/t/OFMvApIDFM

Environment Info:
VS 2013 professional Update3
XVS 3.6.253.0
Comment 2 tom.1.freeman 2014-10-02 12:24:09 UTC
I get this error as well:

1>------ Build started: Project: PROJECT1, Configuration: Debug Any CPU ------
1>  Restoring NuGet packages...
1>  To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
1>  All packages listed in packages.config are already installed.
1>  Consider app.config remapping of assembly "System.Security, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "2.0.0.0" [C:\WINDOWS\assembly\GAC_MSIL\System.Security\2.0.0.0__b03f5f7f11d50a3a\System.Security.dll] to Version "4.0.0.0" [C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Security\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Security.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Net.Primitives, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "3.9.0.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Net.Primitives.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Data.SqlXml, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.0.0" [C:\WINDOWS\assembly\GAC_MSIL\System.Data.SqlXml\2.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll] to Version "4.0.0.0" [C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Data.SqlXml\v4.0_4.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Configuration, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "2.0.0.0" [C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll] to Version "4.0.0.0" [C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "1.5.0.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\System.Net.Http.dll] to solve conflict and get rid of warning.
1>  Consider app.config remapping of assembly "System.Threading.Tasks, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "2.6.7.0" [] to Version "4.0.0.0" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.Threading.Tasks.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Security" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Primitives" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Data.SqlXml" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Configuration" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="System.Threading.Tasks" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(642,2): monodroid error XA0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com. Reason: System.IO.FileNotFoundException: Could not load assembly 'DEPENDENT PROJECT, Version=, Culture=neutral, PublicKeyToken=null'. Perhaps it doesn't exist in the Mono for Android profile?
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

The solution was compiling perfectly well until today.

Here's the version info from Visual studio:

----------------------------------------------------------------------------

Microsoft Visual Studio Ultimate 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0452003-02534
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

LightSwitch for Visual Studio 2013   06181-004-0452003-02534
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06181-004-0452003-02534
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0452003-02534
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0452003-02534
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0452003-02534
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0452003-02534
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0452003-02534
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06181-004-0452003-02534
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.3.50717.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

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

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

Image Optimizer   1.0
Information about my package

Image Watch   1.0


JetBrains ReSharper 8.2   C# Edition build 8.2.0.2160 on 2014-03-20T19:53:08
JetBrains ReSharper 8.2 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2014 JetBrains, Inc.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

NCrunch   
Continuous Testing Tool for .NET
Copyright © 2010-2014 Remco Software Ltd

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

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.2
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.40706.0
Microsoft SQL Server Data Tools

StyleCop   4.7.48.0
Provides source code style and consistency tools. See http://www.stylecop.codeplex.com/ for more details.

tangible T4 Editor   2.2.0
tangible engineering GmbH

TechTalk SpecFlow   1.9.3
TechTalk SpecFlow - Binding business requirements to .NET code, http://www.specflow.org
Copyright © 2009–2013 TechTalk

Visual Studio Tools for Unity   1.9.0.0
Visual Studio Tools for Unity

Windows Azure Tools   2.2
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.2.11003.1601

Windows Azure Tools   2.3
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.3.20320.1602

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.6.262.0 (21b7dba8736246dfd10e3f19a92ed68f1b30abfd)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.16.0.17 (2a7b68212b17c903160fbd8e0106babb299d1be3)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.0.66.0 (3e201c8aa14879773f966f483329bcda49fd3a41)
Visual Studio extension to enable development for Xamarin.iOS.

XAML Spy   2.3.1
XAML Spy for Visual Studio
Copyright © First Floor Software. All rights reserved.

Spy all the XAML!
http://xamlspy.com

XamlStylerVSPackage   1.0
Xaml Styler.

Git Extensions
Git Extensions is a graphical interface for Git
For more information about Git Extensions, see the Git Extensions website at
http://code.google.com/p/gitextensions/
Copyright © 2012 Henk Westhuis
Comment 3 kpickard@flightdocs.com 2015-08-12 20:24:45 UTC
I'm running into this build error trying to compile a Xamarin.Android project:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.Net.Http.Primitives.dll'
  at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in <filename unknown>:0 
  at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (ICollection`1 assemblies, Mono.Cecil.AssemblyDefinition assembly, Boolean topLevel) [0x00000] in <filename unknown>:0 
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x00000] in <filename unknown>:0  (Enviouchegou.Android)
Comment 4 Jonathan Pryor 2015-08-21 15:32:37 UTC
FileNotFoundException is thrown when an assembly can't be resolved.

For example, consider if you have two assemblies, A.dll and B.dll. B.dll depends on A.dll.

Further assume that you have a Xamarin.Android app which references B.dll. In order to build, package, and run this app, A.dll must also be present.

The FileNotFoundException is thrown when A.dll can't be found.

In the case of Comment #0, App5.dll was referenced, but couldn't be found.

In the case of Comment #2, DEPENDENT PROJECT.dll was referenced, but couldn't be found.

In the case of Comment #3, System.Net.Http.Primitives.dll was referenced, but couldn't be found.

In all instances, the fix is to find the assembly that couldn't be found, then "normally" reference that assembly within your projects so that it can be found.
Comment 5 Chris Hardy [MSFT] 2017-06-28 19:16:18 UTC
Answered by Jonp