I saw multiples post/question about it on StackOverflow but about ASP.NET
I am getting the following:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.Web.Mvc.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00099] in /Users/builder/data/lanes/5749/9cfa7836/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:229
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00000] in /Users/builder/data/lanes/5749/9cfa7836/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:179
at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver, System.Collections.Generic.ICollection`1[T] assemblies, Mono.Cecil.AssemblyDefinition assembly, System.Boolean topLevel) [0x0015c] in <998d78d5ee6d46b491b77aff8eeaf856>:0
at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x001c7] in <998d78d5ee6d46b491b77aff8eeaf856>:0 (NightLine.Droid)
Now the interesting point is that my project isn't an ASP.NET project att all x) So first, what the hell?
I did this video: https://channel9.msdn.com/Shows/XamarinShow/Snack-Pack-15-Upgrading-to-XamarinForms-to-NET-Standard
I upgrated the .NET Standard project to 2.0. My Android target is 8.0 and the compiler as well. I tried to upgrade all of my Xamarin.Android.* packages but no success...
Any idea?
Thanks
I am signing both pcl and uwp and getting error:
System.IO.FileLoadException: Could not load file or assembly 'Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Indeed the assembly Xamarin.Forms.Xaml is not signed (Strong name = false)
I took a fresh auto-generated project and added basically this code:
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
[assembly: Dependency(typeof(TestUWPFilePicker.UWP.FilePicker))]
namespace TestUWPFilePicker.UWP
{
public class FilePicker : IFilePicker
{
public async Task<string> PickFolder()
{
var folderPicker = new Windows.Storage.Pickers.FolderPicker();
folderPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.Desktop;
folderPicker.FileTypeFilter.Add("*");
Windows.Storage.StorageFolder folder = await folderPicker.PickSingleFolderAsync();
if (folder != null)
{
// Application now has read/write access to all contents in the picked folder
// (including other sub-folder contents)
Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder);
return folder.Path;
}
else
{
return null;
}
}
}
}
It throws me 42 errors
Severity Code Description Project File Line Suppression State
Error CS0518 Predefined type 'System.Void' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 13 Active
Error CS4036 'IAsyncOperation<StorageFolder>' does not contain a definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a first argument of type 'IAsyncOperation<StorageFolder>' could be found (are you missing a using directive for 'System'?) TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 16 Active
Error CS1729 'object' does not contain a constructor that takes 0 arguments TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 8 Active
Error CS1703 Multiple assemblies with equivalent identity have been imported: 'C:\Users\some-user\.nuget\packages\Microsoft.NETCore.Portable.Compatibility\1.0.2\ref\netcore50\System.dll' and 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'. Remove one of the duplicate references. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\CSC 1 Active
Error CS0518 Predefined type 'System.Boolean' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 17 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 8 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 10 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 12 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 12 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 13 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 16 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 16 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 21 Active
Error CS0518 Predefined type 'System.Object' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 21 Active
Error CS0518 Predefined type 'System.String' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 10 Active
Error CS0518 Predefined type 'System.String' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 14 Active
Error CS0518 Predefined type 'System.String' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 21 Active
Error CS0518 Predefined type 'System.String' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 22 Active
Error CS0518 Predefined type 'System.Type' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 5 Active
Error CS0518 Predefined type 'System.Void' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 12 Active
Error CS0518 Predefined type 'System.Void' is not defined or imported TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 21 Active
Error CS1983 The return type of an async method must be void, Task or Task<T> TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 10 Active
Error CS0012 The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 13 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\App.g.i.cs 20 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\App.g.i.cs 31 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\App.g.i.cs 36 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\MainPage.g.i.cs 17 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\MainPage.g.i.cs 23 Active
Error CS0012 The type 'IList<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 14 Active
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 13 Active
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 14 Active
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 16 Active
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 17 Active
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 21 Active
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 21 Active
Error CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 22 Active
Error CS0012 The type 'Task<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Threading.Tasks, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 8 Active
Error CS0246 The type or namespace name 'Dependency' could not be found (are you missing a using directive or an assembly reference?) TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 5 Active
Error CS0246 The type or namespace name 'DependencyAttribute' could not be found (are you missing a using directive or an assembly reference?) TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 5 Active
Error CS0246 The type or namespace name 'Task<>' could not be found (are you missing a using directive or an assembly reference?) TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 10 Active
Error CS0234 The type or namespace name 'Tasks' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?) TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 2 Active
Error CS0246 The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) TestUWPFilePicker.UWP c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\FilePicker.cs 3 Active
and 13 warnings
Severity Code Description Project File Line Suppression State
Warning A problem occurred while trying to set the "References" parameter for the IDE's in-process compiler. An item with the same key has already been added. TestUWPFilePicker.iOS
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. TestUWPFilePicker.Android 1 Active
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. TestUWPFilePicker.iOS 1 Active
Warning Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 4
Warning Error: No resource found that matches the given name: attr 'colorAccent'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 3
Warning Error: No resource found that matches the given name: attr 'colorAccent'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 4
Warning Error: No resource found that matches the given name: attr 'colorPrimary'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning Error: No resource found that matches the given name: attr 'colorPrimaryDark'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning Error: No resource found that matches the given name: attr 'windowActionBar'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning Error: No resource found that matches the given name: attr 'windowActionModeOverlay'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 4
Warning Error: No resource found that matches the given name: attr 'windowNoTitle'. TestUWPFilePicker.Android c:\users\some-user\documents\visual studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning No way to resolve conflict between "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily. TestUWPFilePicker.UWP
My UWP project has references to System, my PCL and Universal Windows. The PCL refers .NET, Xamarin.Forms.Core, Xamarin.Forms.Platform and Xamarin.Forms.Xaml. Min version is Windows 10 (10.0; Build 10240) and target version is Windows 10 Anniversary Edition (10.0; Build 14393). NuGet Package Manager shows me Microsoft.NETCore.UniversalWindowsPlatform 5.2.2 installed (only UWP) and Xamarin.Forms 2.3.4.224, despite it doesn't show up under UWP references.
If I uninstall and install Xamarin.Forms 2.3.4.247 and want to deploy on my Windows Phone again I get only 6 errors
Severity Code Description Project File Line Suppression State
Error CS1703 Multiple assemblies with equivalent identity have been imported: 'C:\Users\some-user\.nuget\packages\Microsoft.NETCore.Portable.Compatibility\1.0.2\ref\netcore50\System.dll' and 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'. Remove one of the duplicate references. TestUWPFilePicker.UWP c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\CSC 1 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\App.g.i.cs 20 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\App.g.i.cs 31 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\App.g.i.cs 36 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\MainPage.g.i.cs 17 Active
Error CS0433 The type 'GeneratedCodeAttribute' exists in both 'System.Diagnostics.Tools, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' TestUWPFilePicker.UWP c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.UWP\obj\ARM\Debug\MainPage.g.i.cs 23 Active
and again 13 warnings
Severity Code Description Project File Line Suppression State
Warning Could not copy "obj\Debug\TestUWPFilePicker.dll" to "bin\Debug\TestUWPFilePicker.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Debug\TestUWPFilePicker.dll' because it is being used by another process. TestUWPFilePicker
Warning Could not copy "obj\Debug\TestUWPFilePicker.dll" to "bin\Debug\TestUWPFilePicker.dll". Beginning retry 2 in 1000ms. The process cannot access the file 'bin\Debug\TestUWPFilePicker.dll' because it is being used by another process. TestUWPFilePicker
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. TestUWPFilePicker.Android 1 Active
Warning Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 4
Warning Error: No resource found that matches the given name: attr 'colorAccent'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 3
Warning Error: No resource found that matches the given name: attr 'colorAccent'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 4
Warning Error: No resource found that matches the given name: attr 'colorPrimary'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning Error: No resource found that matches the given name: attr 'colorPrimaryDark'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning Error: No resource found that matches the given name: attr 'windowActionBar'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning Error: No resource found that matches the given name: attr 'windowActionModeOverlay'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 4
Warning Error: No resource found that matches the given name: attr 'windowNoTitle'. TestUWPFilePicker.Android c:\Users\some-user\Documents\Visual Studio 2015\Projects\TestUWPFilePicker\TestUWPFilePicker\TestUWPFilePicker.Android\Resources\values\styles.xml 2
Warning No way to resolve conflict between "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily. TestUWPFilePicker.UWP
What is wrong with my references?
Currently, I have Xamarin 4.5.0.443 and Visual Studio 2015 installed. I tried to search for solutions for CS1703 without success. Now I tried to change the target profile, giving me again different errors (37) and warnings (11).
Please update to Xamarin 4.5.0.486 and remove System reference from UWP client project.
I have a web app that uses MEF, Webapi and OData.
For MEF I created a helper class that loads the catalog on demand (at first access)
The following is MEF integration code.
Public Shared ReadOnly Property Catalog As AggregateCatalog
Get
If _catalog Is Nothing Then
Dim catFolder = "."
Dim path = AppDomain.CurrentDomain.BaseDirectory.ToLower
_catalog = new AggregateCatalog()
Dim di = New DirectoryInfo(path)
Dim dlls = di.GetFileSystemInfos("MyApp.*.dll")
_catalog = New AggregateCatalog()
For Each dll In dlls
Try
Dim ac = New AssemblyCatalog(Assembly.LoadFile(dll.FullName))
Dim parts = ac.Parts.ToArray() 'throws ReflectionTypeLoadException
_catalog.Catalogs.Add(ac)
Catch ex As ReflectionTypeLoadException
Log.Instance.Error("Error when Trying to load {0}", dll.FullName)
Log.Instance.Error(ex)
For Each iex In ex.LoaderExceptions
Log.Instance.Error(iex)
Next
End Try
Next
End If
Return _catalog
End Get
End Property
One of my projects (the actual web app project) uses the following nuget packages (among others):
WebApi 5.2.3
WebApi.OData 5.7.0
My problem is when MEF class tries to load this assembly (the one that uses OData and WebApi, it thrown a runtime error, which is logged below.
The problem occurs ONLY in deployment, on production machine. In development all works ok.
As you can see in the error below, it seems that, even if the project references System.Web.Http version 5.2.3.0, at runtime System.Web.Http.Odata assembly is trying to load System.Web.Http version 5.2.2.0 (!?!?!?)
In my project, the reference is set to correct dll (version 5.2.3.0), the dll is set with Copy Local=True, and in web.config I have
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
I don't have any class needed to be composed by MEF in this project (assembly), so I could simply exclude it from being load by MEF, but this error is puzzling me, and I would like to find a solution, in case I encounter similar problem in other assemblies.
Here is the error I get
2015-11-04 07:17:02.7758|ERROR|MyPermitNow.Log|Error when Trying to load m:\web\www.mypermitnow.org\web_1\bg-processor\MyPermitNow.Jurisdiction.dll
2015-11-04 07:17:02.7758|ERROR|MyPermitNow.Log|System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator()
at System.Linq.EnumerableQuery`1.GetEnumerator()
at System.Linq.EnumerableQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at MyPermitNow.MEFHelper.get_Catalog()
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator()
at System.Linq.EnumerableQuery`1.GetEnumerator()
at System.Linq.EnumerableQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at MyPermitNow.MEFHelper.get_Catalog()
2015-11-04 07:17:02.7758|ERROR|MyPermitNow.Log|System.IO.FileLoadException: Could not load file or assembly 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
=== Pre-bind state information ===
LOG: DisplayName = System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///M:/web/www.mypermitnow.org/web_1/bg-processor/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Web.Http.OData, Version=5.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Attempting download of new URL file:///M:/web/www.mypermitnow.org/web_1/bg-processor/System.Web.Http.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Build Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
There could be a lot of things that could cause this. Some things to check:
Is there an old version of the DLL on the server having problems? It is possible the CSPROJ now has Private=true for the assembly when it didn't use to, then that library is included in the main applicate/site project. So the new one isn't getting copied, but the old one is sitting there but in a more direct spot so it is loading first.
Any app/web.config transforms going on that could be replacing the assembly binding XML?
If it's not in the direct application folders, what's in the GAC?
Turn on the Fusion assembly loading logging
So I create a Forms solution, in my PCL project I add the NuGet Microsoft.WindowsAzure.Mobile.
When I run my Android project (which of course references the PCL project), I get:
[MonoDroid] UNHANDLED EXCEPTION:
System.Reflection.TargetInvocationException: Exception has been
thrown by the target of an invocation.
---> System.InvalidOperationException:
A Microsoft Azure Mobile Services assembly for the current platform was not found.
Ensure that the current project references both Microsoft.WindowsAzure.Mobile and the following platform-specific
assembly: Microsoft.WindowsAzure.Mobile.Ext.
Ok, fine, I add the Microsoft.WindowsAzure.Ext (by manually Edit References->Browse to the ..packages..Microsoft.WindowsAzure.Mobile.Ext assembly and add it) to my Android project, but then I get:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
Error: Duplicate managed type found! Mappings between managed types
and Java types must be unique. First Type:
'Xamarin.Auth.AndroidAccountStore/SecretAccount, Xamarin.Auth.Android,
Version=1.2.2.0, Culture=neutral, PublicKeyToken=null'; Second Type:
'Xamarin.Auth.AndroidAccountStore/SecretAccount,
Microsoft.WindowsAzure.Mobile.Ext, Version=1.2.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' (MyApp.Android)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
Error: Duplicate managed type found! Mappings between managed types
and Java types must be unique. First Type:
'Xamarin.Auth.FormAuthenticatorActivity, Xamarin.Auth.Android,
Version=1.2.2.0, Culture=neutral, PublicKeyToken=null'; Second Type:
'Xamarin.Auth.FormAuthenticatorActivity,
Microsoft.WindowsAzure.Mobile.Ext, Version=1.2.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' (MyApp.Android)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
Error: Duplicate managed type found! Mappings between managed types
and Java types must be unique. First Type:
'Xamarin.Auth.FormAuthenticatorActivity/State, Xamarin.Auth.Android,
Version=1.2.2.0, Culture=neutral, PublicKeyToken=null'; Second Type:
'Xamarin.Auth.FormAuthenticatorActivity/State,
Microsoft.WindowsAzure.Mobile.Ext, Version=1.2.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' (MyApp.Android)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
Error: Duplicate managed type found! Mappings between managed types
and Java types must be unique. First Type:
'Xamarin.Auth.WebAuthenticatorActivity, Xamarin.Auth.Android,
Version=1.2.2.0, Culture=neutral, PublicKeyToken=null'; Second Type:
'Xamarin.Auth.WebAuthenticatorActivity,
Microsoft.WindowsAzure.Mobile.Ext, Version=1.2.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' (MyApp.Android)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
Error: Duplicate managed type found! Mappings between managed types
and Java types must be unique. First Type:
'Xamarin.Auth.WebAuthenticatorActivity/State, Xamarin.Auth.Android,
Version=1.2.2.0, Culture=neutral, PublicKeyToken=null'; Second Type:
'Xamarin.Auth.WebAuthenticatorActivity/State,
Microsoft.WindowsAzure.Mobile.Ext, Version=1.2.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' (MyApp.Android)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
Error: Duplicate managed type found! Mappings between managed types
and Java types must be unique. First Type:
'Xamarin.Auth.WebAuthenticatorActivity/Client, Xamarin.Auth.Android,
Version=1.2.2.0, Culture=neutral, PublicKeyToken=null'; Second Type:
'Xamarin.Auth.WebAuthenticatorActivity/Client,
Microsoft.WindowsAzure.Mobile.Ext, Version=1.2.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' (MyApp.Android)
Seems to be some conflict with Xamarin.Auth?
How do I solve this?
I have manage to find a workaround. Create a Portable Class Library in which you add the nugget version of mobile services. In this way you can make a wrapper over the existing mobile services from the pcl. This clearly works and it the best solution till the bug is fixed. If you have any questions please feel free to ask.
This error is resolved as of version 1.2.5 of the Mobile Services SDK.