[英]System.IO.FileNotFoundException: Could not load assembly System.Web in Mono for Android
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 我正在使用Xamarin构建一个使用SkyDrive .Net API客户端的Android应用程序,但是当我在模拟器上运行我的Android应用程序时遇到以下错误
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. 显然我不能在Xamarin.Android中使用System.Web程序集。 So, the question is if there is a way to load the missing assembly or i have to move to another API?
所以,问题是,是否有办法加载缺少的程序集或我必须转移到另一个API?
Thanks in advance 提前致谢
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). 我想你已经编译好了,所以它是Xamarin和MS .net之间的一个库命名区别,没有System.Web.dll(但几乎所有类都存在于System.Web命名空间内,但它们在其他库中)。
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). 解决方案是下载客户端的源代码,在同一解决方案中的Xamarin Studio内添加一个新的Android库项目,将客户端的所有代码文件添加到该项目中,在主项目中添加任何必要的参考和引用该项目,这样就可以链接正确的库(如果没有缺少类,正如我所说,几乎没有,但不是全部)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.