Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, In release

Hello ,

Getting the same in release build, but in debug configuration it works fine.

{System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
File name: 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at (wrapper managed-to-native) System.MonoCustomAttrs.IsDefinedInternal(System.Reflection.ICustomAttributeProvider,System.Type)
at System.MonoCustomAttrs.IsDefined (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00027] in /Users/builder/jenkins/workspace/xamarin-android-d15-6/xamarin-android/external/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:317
at System.Attribute.InternalIsDefined (System.Reflection.PropertyInfo element, System.Type attributeType, System.Boolean inherit) [0x00000] in /Users/builder/jenkins/workspace/xamarin-android-d15-6/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/attribute.cs:86
at System.Attribute.IsDefined (System.Reflection.MemberInfo element, System.Type attributeType, System.Boolean inherit) [0x0006c] in /Users/builder/jenkins/workspace/xamarin-android-d15-6/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/attribute.cs:621
at System.Reflection.CustomAttributeExtensions.IsDefined (System.Reflection.MemberInfo element, System.Type attributeType, System.Boolean inherit) [0x00000] in /Users/builder/jenkins/workspace/xamarin-android-d15-6/xamarin-android/external/mono/mcs/class/referencesource/mscorlib/system/reflection/CustomAttributeExtensions.cs:163
at Newtonsoft.Json.Serialization.DefaultContractResolver.GetSerializableMembers (System.Type objectType) [0x000a6] in :0
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateProperties (System.Type type, Newtonsoft.Json.MemberSerialization memberSerialization) [0x00000] in :0


Another Log is


he request to load the assembly System.ComponentModel.DataAnnotations v4.0.0.0 was remapped to v2.0.5.0
11-21 17:16:50.877 D/Mono (28931): Unloading image System.ComponentModel.DataAnnotations.dll [0xcd8c8700].
11-21 17:16:50.878 D/Mono (28931): Image addref System.ComponentModel.DataAnnotations[0xcc8c3e00] -> System.ComponentModel.DataAnnotations.dll[0xccfa2100]: 3
11-21 17:16:50.878 D/Mono (28931): Image for assembly 'System.ComponentModel.DataAnnotations' (System.ComponentModel.DataAnnotations.dll) has ReferenceAssemblyAttribute, skipping
11-21 17:16:50.878 D/Mono (28931): Assembly Loader probing location: '/usr/local/lib/mono/gac/System.ComponentModel.DataAnnotations/2.0.5.0__31bf3856ad364e35/System.ComponentModel.DataAnnotations.dll'.
11-21 17:16:50.878 D/Mono (28931): Assembly Loader probing location: '/System.ComponentModel.DataAnnotations.dll'.
11-21 17:16:50.878 D/Mono (28931): Assembly Loader probing location: '/usr/local/lib/System.ComponentModel.DataAnnotations.dll'.
11-21 17:16:50.878 D/Mono (28931): Assembly Loader probing location: '/usr/local/lib/mono/gac/System.ComponentModel.DataAnnotations/2.0.5.0__31bf3856ad364e35/System.ComponentModel.DataAnnotations.exe'.
11-21 17:16:50.878 D/Mono (28931): Assembly Loader probing location: '/System.ComponentModel.DataAnnotations.exe'.
11-21 17:16:50.878 D/Mono (28931): Assembly Loader probing location: '/usr/local/lib/System.ComponentModel.DataAnnotations.exe'.
11-21 17:16:50.878 W/Mono (28931): The following assembly referenced from ProjectName.Common.dll could not be loaded:
11-21 17:16:50.878 W/Mono (28931): Assembly: System.ComponentModel.DataAnnotations (assemblyref_index=4)
11-21 17:16:50.878 W/Mono (28931): Version: 4.0.0.0
11-21 17:16:50.878 W/Mono (28931): Public Key: 31bf3856ad364e35
11-21 17:16:50.878 W/Mono (28931): The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/).
11-21 17:16:50.878 D/Mono (28931): Failed to load assembly ProjectName.Common[0xe4192f40].
11-21 17:16:50.878 W/ (28931): Can't find custom attr constructor image: ProjectName.Common.dll mtoken: 0x0a000024 due to: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. assembly:System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type: member:
11-21 17:16:50.927 D/Mono (28931): DllImport attempting to load: '/system/lib/liblog.so'.System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

Answers

  • viveksamele08viveksamele08 USMember ✭✭

    Do you have any solution for that, Will be helpfull. No support form xamarin

  • jezhjezh Member, Xamarin Team Xamurai

    You can try to set linking to none. just as follows:

Sign In or Register to comment.