Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.IO.FileNotFoundException: Could not load assembly...perhaps doesn't exist in the Mono for Android Profile?

I am getting the following error when trying to compile my Android App from Visual Studio (I am using Xamarin plug in).

Error 2 Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'PresentationUI, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Perhaps it doesn't exist in the Mono for Android profile?

File name: 'PresentationUI.dll' at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference

reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1

assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1

assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute()

I had a look around and found this forum post which looks like a similar problem. I couldn't find the PresentationUI.dll assembly tho.

Any suggestion on why am I getting this error and how to fix it?

Update

I found that the problem actually comes from using DelegateCommand from Microsoft.Practices.Prism.dll Is it because this assembly is not supported by Xamarin?

Cheers,

like image 952
YKa Avatar asked Apr 10 '14 00:04

YKa


2 Answers

PresentationUI is part of WPF (UI framework on Windows), which is not available on mobile platforms, such as Xamarin.Android.

You have to recreate a mobile compatible UI of your application so as to be Android ready.

Microsoft designs Prism to work with WPF, so yes you cannot use it in a Xamarin.Android project. (Prism latest build does work with Xamarin Forms though).

Reference: .NET Cross Platform UI Frameworks

like image 185
Lex Li Avatar answered Oct 30 '22 19:10

Lex Li


This exception means that in your mobile project somewhere in code you are using elements from PresentationUI that is WPF part and as mentioned above it can't be used in Xamarin.Android. Just review your code and make sure that you aren't using something from PresentationUI. Hope this will help.

like image 37
Ostap Gnatievych Avatar answered Oct 30 '22 21:10

Ostap Gnatievych