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

风格不统一 提交于 2019-12-23 18:45:58

问题


I'm building an android app with Xamarin that uses SkyDrive .Net API Client but I'm getting the following error when trying to run my android app on the emulator

Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.Web.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 (System.Collections.Generic.List`1 assemblies, Mono.Cecil.AssemblyDefinition assembly, Boolean topLevel) [0x00000] in <filename unknown>:0 
  at Xamarin.Android.Tasks.ResolveAssemblies.Execute () [0x00000] in <filename unknown>:0  (MyApp)

Apparently i cannot use the System.Web assembly in Xamarin.Android. So, the question is if there is a way to load the missing assembly or i have to move to another API?

Thanks in advance


回答1:


Did you compiled the client from source or just got it in binary form?

I suppose you got it already compiled, so it's a library naming difference between Xamarin and MS .net, there is no System.Web.dll (but nearly all the classes exists inside the System.Web namespace but they are on other libraries).

The solution is to download the client's source code, inside Xamarin Studio in your same solution add a new Android Library project, add all the code files from the client to that project, add any necessary reference and reference that project in your main project, in this way the correct libraries will be linked (if no class is missing, as I said there are barely all, but not all).



来源:https://stackoverflow.com/questions/23228830/system-io-filenotfoundexception-could-not-load-assembly-system-web-in-mono-for

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!