I've added the Xamarin.Android build task to my VSO Build, using the Hosted build agent. When VSO runs the task, it fails with the error message:
2015-08-20T16:39:01.2412835Z 1>CSC : error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\mscorlib.dll' and 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll'. Remove one of the duplicate references. [C:\a\a815ee8d\phoneword\PhonewordAndroid\PhonewordAndroid.csproj]
I don't have this problem when I build my Xamarin.Android project locally via Visual Studio 2015 or using the command line.
Thanks for reporting this issue. I will take a look.
Could you please let me know if you are building this sample app from Xamarin? https://github.com/xamarin/mobile-samples/tree/master/Phoneword
I am not able to reproduce this issue from my end, I can build this app on VSO.
Sort of. It's a slight variant of it. I'm using a PCL for the common code, I've removed the iOS project, and also added a UITest project. If you want I can invite you to the VSO team I have setup for this.
That would be great! Could you please invite [email protected] to the VSO team?
I repro'ed the issue here on my account. Thanks for the project, I will circle back once I figured out the issue.
Well, in your csproj file, I deleted this line:
Reference Include="mscorlib"
and now it builds on VSO. I am assuming in your local dev box you probably don't have one of the conflicting mscorlib?
In any case, once you remove this reference your solution should build.
Update: I was using Xamarin 3.11.836 and Visual Studio 2015 Pro. When I reverted to Xamarin 3.11.666, the build task works.
For now, the workaround is to use Xamarin 3.11.666 for your local development.
Xamarin 3.11.836 was release a few days after we upgraded our tooling to 3.11.666. We will upgrade the tools on VSO. I will close this issue after the deployment.
Thanks for reporting the issue!
Cross reference Xamarin bugzilla issue 33294
The issue seems have been resolved in more recent builds of Xamarin for Visual Studio (3.11.1443 or higher). Closing this off.
Hi guys, the error is active again on VSO using android v7.
Facing the same issue.
Reopening the issue, as it seems that two users are reporting the problem again.
Me too facing this issue is there any temporary solution?
Can you please post the failed job log? Does delete Reference Include="mscorlib"
from the csproj file work?
@madhurig do you have any insights on this issue?
Me too facing this issue is there any temporary solution?
Yes there is a solution: switch back to Android v6
Can you please post the failed job log? Does delete Reference Include="mscorlib" from the csproj file work?
Not working for me. Shows another error during build.
We have submitted a pull request to update the hosted image with Android SDK to v7. I am not sure if hosted image has been updated with Android v7 yet.
The master hosted image copy has been updated and we are in the process of verifying the changes now. The current ETA is by end of next week if there are no surprises. You should receive the new image by 10/16.
I'm seeing the same issue. I removed mscorlib reference in both the PCL and Droid project. Also I uncheck the C# settings options in project settings -> "Do not reference mscorlib.dll" option.
I'll test the new image on 10/16
Is the new image already available for testing?
Sorry for the delay, I was just informed that we may still need couple extra days to rollout the image due to an issue. :(
Any further feedback on this? Having android CI broken = :(
Are you still facing issues?
The hosted image should have been update with Android v7 (v24), can you post your build failure in a new issue? Was your build working before and now it stopped working? Are you using latest Google support and extra libraries? Those libraries update quite fast and you may experience some delay in getting the last library on to the hosted image due to scheduling and testing involved in the image generation process. :(
If you don't absolutely need the latest support / extra libraries, lowering the version down usually would unblock you.
Last successful Android CI build was on 22 Sep - after which something changed that broke it.
using xamarin forms android - so cannot use the latest android support libraries because xamarin forms does not support them yet.
Here's the current error:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1616,5): Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'Mono.Security.Cryptography.SymmetricTransform' (defined in 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e') from 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve Mono.Security.Cryptography.SymmetricTransform
Additional info:
Xamarin forms android support libs are currently 23.3.0
Compile using latest platform (android 7.0) -> this perhaps what is causing the issue?
Linker option = Sdk Assemblies only
Same issue. Any update on this topic?
Does compile using Android 6 works? Android v7 was recently introduced to hosted image, maybe that change broke your build?
I can confirm - build is green if compile target is Android 6.
Would prefer not to have to change that just to get my CI to work though :|
Same issue here... Changing to 6 solved it, but that's definitely not optimal.
Any updates on this issue?
I don't want to edit my .csproj and change TargetFramework.
From the linked issue, Madhuri mentioned we will be updating the hosted image early next year after the holidays to include Xamarin.Android 7 support..
Sorry for the inconvenience.
@yacaovsnc thanks for the heads-up, I appreciate it!
Are you planning to automate updating the hosted image whenever Xamarin makes a new release? So these situations are avoided.
@andreinitescu the tools on the hosted image always lag behind. with a private agent you can control the tools installed.
encounter same problem today and "delete Reference Include="mscorlib"" fixed it
Open the .csproj file in notepad and then delete the Reference Include="mscorlib". This solves the issue.
Any news on updating the hosted image?
What's the logical explanation for deleting mscorlib
reference from .csproj file? Why does that solves the issue?
Also having the issue, removing the mscorlib from android project did not solve the problem. Created the extra problem:
_MSB4018: The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Reference to metadata item 'Mono.Security.Cryptography.SymmetricTransform' (defined in 'System.Core, Version=2.0.5.0,_
for now switched back to targetframework 6.0. Also note that I was using targetframework 7.1 and the beta version of forms.
Facing the same problem still. When targeting 7.1 I receive the mscorlib error. When removed from proj file, we recieve MSB4018: The "LinkAssemblies" task failed unexpectedly.
Building works again when target sdk is set to 7.0.
@Reijnn : Xamarin Android version was updated at the end of Dec 2016 to 7.0. If you target a higher version like 7.1, you will continue seeing the "LinkAssemblies" task failure since that is not available on the hosted build VMs.
Thanks,
Madhuri
Hi Everyone!! Could this be related with the proguard version issue, documented by Xamarin?
The Android SDK is shipping with an old proguard version that crashes when the target version of the project is Android 7.0+, the workaround is to update the proguard tool by hand within the android-sdk folder. I'm now able to build release version (proguard) within VisualStudio, but I'm still unable to build them in VSTS.
Could you please check on this thread?
Why can't the tools on the hosted build VMs be kept up to date with Xamarin releases?
Xamarin is part of Microsoft for a year now...
Part of their release it should be updating the hosted build VMs.
@apestchanker: This failure happens when you target 7.1 even without dependency on proguard. Once the tools on the hosted build VMs are updated, the error with LinkAssemblies should go away when targeting 7.1. The proguard version not being updated with Android SDK is also known and being tracked: https://github.com/Microsoft/vsts-tasks/issues/3355
@opcodewriter : I hear your frustration. One of the reasons hosted build VM update is slow is that we have one image for all the customers. We can't apply unstable/beta releases to it and even stable channel builds could have bugs that break existing builds. There is infrastructure work being done to make this better. We hope to make it more automated and faster than it is today.
@madhurig Thanks, it makes sense. I guess the best would be if VSTS would be able to figure out the version of Xamarin from .csproj and use it to build the app. Or give VSTS user a way to choose the version like from a dropdown.
I wonder how soon can we expect this, I guess not anytime "soon", like months.
@madhurig Is there an overview of the currently supported (Android) SDK versions?
https://www.visualstudio.com/en-us/docs/build/concepts/agents/hosted has a "Software" section that is kept up to date with all the software installed on the hosted build VMs.
it's not that updated.. so what's the process this keeps updated? Can we make a pr?
C9 stable is out, i would hope the next day support on VSTS ...
@rmarinho: Cycle 9 is now available on the hosted build VMs. We would like to speed up the update process and are working on some improvements. The process is not open source, so we can't accept PRs currently.
Awesome, thanks!
@madhurig commented on 13 mrt. 2017 16:50 CET:
Cycle 9 is now available on the hosted build VMs.
Can you update the hosted agents software list.
@thechrisjohnson is updating it today
Also de capabilities seem to not be correct does the agent version number changes for example when you update Xamarin ?
@rmarinho : Agent version need not change with every hosted build update.