I currently have a Xamarin.Android project that references a .NET Standard 1.1 library that references AutoMapper 5.0.2.
When I try to build this through VSTS I get this error
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1316,2): Error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Collections.Specialized, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
This solution builds perfectly fine on my local machine and runs in the Android Emulator.
Things I have tried (and none have worked)
- Installing the AutoMapper Nuget package directly against the Android Project.
- Installing System.Collections.Specialized in the Android project.
- Doing
<CopyNuGetImplementations>true</CopyNuGetImplementations>
in the Android Project.
Also just as a side note, I have .NET Standard 1.1 Libraries all the way through my project, yet I can see from the build log that its using .NET Standard 1.3. Not sure if this will make a difference as I am not sure how the build process manages these standards.
Copying file from "C:\Users\buildguest.nuget\packages\AutoMapper\5.0.2\lib\netstandard1.3\AutoMapper.dll" to "C:\a\1\b/Release\AutoMapper.dll".
Update 1
Just to add that I have tried using Nuget 3.4.4 and Nuget 3.5.0-beta2 in the build agent and while this solved other issues I was having, it didn't resolve the current one I am experiencing.
Update 2
Here is my Android project.json
{
"dependencies": {
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"MonoAndroid,Version=v6.0": {}
},
"runtimes": {
"win": {}
}
}
Here is my Portable project.json
{
"supports": {},
"dependencies": {
"AutoMapper": "5.0.2",
"NETStandard.Library": "1.6.0",
"Xamarin.Forms": "2.3.0.107"
},
"frameworks": {
"netstandard1.1": {
"imports": "portable-win+net45+wp8+win81+wpa8"
}
}
}
Update 3: 18th July Just adding more test cases
- Did a brand new Xamarin Android project, with packages.config, existing nuget.exe. All works.
- Add AutoMapper reference, builds and runs locally. Fails in VSTS Build Agent
- Updated Nuget.exe - still fails on build
- Update to project.json - still fails on build.
I can not get even a blank project with an AutoMapper 5.0.2 reference working in the Visual Studio Build step of VSTS. Always the same error as above.