System.IO.FileNotFoundException Could not load assembly System.Drawing

jddjdd USMember ✭✭

Hello,

I meet this error in a Xamarin.forms project using WebView and local html base url:

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
Nom de fichier : 'System.Drawing.dll'
à Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
à Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
à Xamarin.Android.Tasks.ResolveAssemblies.Execute() Almicantarat.Droid

I read that: System.IO.FileNotFoundException: Could not load assembly System.Web in Mono for Android

but I don't know which client's source code I should compile.

I read that: Could not load file or assembly 'System.Drawing, Version=4.0.0.0
but in my project, reference to System.Drawing is coming from mono.android which is a Xamarin component!

Should I compile mono.android myself ? where could I find it ? does Xamarin provide it ?

See my references attached.

Thanks

Tagged:

Best Answer

Answers

  • DnyaneshwarDnyaneshwar USMember ✭✭

    @jdd tried above solution but still getting following error.
    Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'

  • jddjdd USMember ✭✭

    @Dnyaneshwar
    First, close VS and update the android SDK.
    Then, did you delete all the files from the "packages" folder in your solution?
    You should also delete all the files and folders in the "bin>debug" folders of your projects.
    Last, restart VS and Rebuild your project.

  • DnyaneshwarDnyaneshwar USMember ✭✭

    @jdd thanks

  • johanksonjohankson SEInsider, University ✭✭

    Still experiencing this issue... Any hints...

  • jddjdd USMember ✭✭

    did you try to update android sdk and java ?

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    XS Ent 6.1.5 (build 0) on Mac: updated to the latest XF 2.3.3.193 (same happens with 2.3.4.22-nightly) and on Android getting build error trying to run on v6.0
    getting exception System.IO.FileNotFoundException: Could not load assembly 'System.Drawing
    already tried deleting and restoring all packages, bin and lib folders etc...
    here is the full exception:

    /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.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x0015d] in :0
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in :0
    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x00180] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0
    at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x001ec] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 (UHCNV.APP.MYSMA.Droid)

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    XS Ent 6.1.5 (build 0) on Mac: updated to the latest XF 2.3.3.193 (same happens with 2.3.4.22-nightly) and on Android getting build error trying to run on v6.0
    getting exception System.IO.FileNotFoundException: Could not load assembly 'System.Drawing
    already tried deleting and restoring all packages, bin and lib folders etc...
    here is the full exception:

    /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.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x0015d] in :0
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in :0
    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x00180] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0
    at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x001ec] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 (UHCNV.APP.MYSMA.Droid)

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    XS Ent 6.1.5 (build 0) on Mac: updated to the latest XF 2.3.3.193 (same happens with 2.3.4.22-nightly) and on Android getting build error trying to run on v6.0
    getting exception System.IO.FileNotFoundException: Could not load assembly 'System.Drawing
    already tried deleting and restoring all packages, bin and lib folders etc...
    here is the full exception:

    /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.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x0015d] in :0
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in :0
    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x00180] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0
    at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x001ec] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 (UHCNV.APP.MYSMA.Droid)

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    XS Ent 6.1.5 (build 0) on Mac: updated to the latest XF 2.3.3.193 (same happens with 2.3.4.22-nightly) and on Android getting build error trying to run on v6.0
    getting exception System.IO.FileNotFoundException: Could not load assembly 'System.Drawing
    already tried deleting and restoring all packages, bin and lib folders etc...
    here is the full exception:

    /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.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x0015d] in :0
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in :0
    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x00180] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0
    at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x001ec] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 (UHCNV.APP.MYSMA.Droid)

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    XS Ent 6.1.5 (build 0) on Mac: updated to the latest XF 2.3.3.193 (same happens with 2.3.4.22-nightly) and on Android getting build error trying to run on v6.0
    getting exception System.IO.FileNotFoundException: Could not load assembly 'System.Drawing
    already tried deleting and restoring all packages, bin and lib folders etc...
    here is the full exception:

    /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.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x0015d] in :0
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in :0
    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x00180] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0
    at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x001ec] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 (UHCNV.APP.MYSMA.Droid)

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    XS Ent 6.1.5 (build 0) on Mac: updated to the latest XF 2.3.3.193 (same happens with 2.3.4.22-nightly) and on Android getting build error trying to run on v6.0
    getting exception System.IO.FileNotFoundException: Could not load assembly 'System.Drawing
    already tried deleting and restoring all packages, bin and lib folders etc...
    here is the full exception:

    /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.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x0015d] in :0
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in :0
    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x00180] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0
    at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x001ec] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 (UHCNV.APP.MYSMA.Droid)

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    XS Ent 6.1.5 (build 0) on Mac: updated to the latest XF 2.3.3.193 (same happens with 2.3.4.22-nightly) and on Android getting build error trying to run on v6.0
    getting exception System.IO.FileNotFoundException: Could not load assembly 'System.Drawing
    already tried deleting and restoring all packages, bin and lib folders etc...
    here is the full exception:

    /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.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x0015d] in :0
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in :0
    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x00180] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0
    at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x001ec] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 (UHCNV.APP.MYSMA.Droid)

  • MarkRadacz.7953MarkRadacz.7953 USInsider, University, Developer Group Leader ✭✭

    XS Ent 6.1.5 (build 0) on Mac: updated to the latest XF 2.3.3.193 (same happens with 2.3.4.22-nightly) and on Android getting build error trying to run on v6.0
    getting exception System.IO.FileNotFoundException: Could not load assembly 'System.Drawing
    already tried deleting and restoring all packages, bin and lib folders etc...
    here is the full exception:

    /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.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
    File name: 'System.Drawing.dll'
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x0015d] in :0
    at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in :0
    at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x00180] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0
    at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x001ec] in <2fdd3551eb6c4960b69522c8a0cd7aa3>:0 (UHCNV.APP.MYSMA.Droid)

  • VijayPawar.0297VijayPawar.0297 USMember ✭✭

    I had same kind of issue when I updated components in project [ Nuget Packages ] so. then I downloaded latest required dll files [I needed 3 ] from
    here

  • AmirAbdiAmirAbdi USMember ✭✭

    The suggested solution did not work.
    I found the source of the problem in using UItest for my android Xamarin project. As soon as I removed the reference to the UITest project from the android project, the project was built with no problem.

    I still don't know how to add the UITest without running into the same exception.

  • mostafamahmoudmostafamahmoud USMember
    edited August 27

    I have Same problem .

  • FilipLarssonFilipLarsson SEMember ✭✭

    Thank you VijayPawar.0297, I did what you said.

    I downloaded System.Drawing.dll and System.Configuration.dll and added them in my bin/debug folder

Sign In or Register to comment.