I am trying to build my Xamarin.iOS application on my Mac using Visual Studio Team Services (was Visual Studio Online) and the VSTS Build Agent (https://github.com/Microsoft/vsts-agent)
When my Xamarin.iOS project comes to build it starts to restore the nuget packages and then errors with the following error:
'MvvmCross.Core' already has a dependency defined for 'MvvmCross.Platform'. 'MvvmCross.Tests' already has a dependency defined for 'MvvmCross.Platform'. 'MvvmCross.Binding' already has a dependency defined for 'MvvmCross.Core'.
I found this post on nuget Error installing MvvmCross.HotTuna.MvvmCrossLibraries v4.0.0-beta1 in Xamarin Studio
which said that this may be caused by old nuget clients.
The current nuget client on my mac is V2.8.6 so I upgraded the nuget client using
nuget update -self
which updated to V3.4.4
But now I am getting the error:
MSBuild auto-detection: using msbuild version '4.0' from '/Library/Frameworks/Mono.framework/Versions/4.4.0/lib/mono/4.5'.
MsBuild.exe does not exist at '/Library/Frameworks/Mono.framework/Versions/4.4.0/lib/mono/4.5/msbuild.exe'.
Is this a bug with Nuget / MvvmCross or the VSTS agent?
You can add the latest version of Nuget.exe to your repository and also add a shell script to execute it and restore Nuget packages on a Mac build server. The shell script would simply have a line similar to:
mono nuget/nuget.exe restore $1
The $1 is a parameter that is passed to the shell script and should point to the solution file you want to restore packages for. nuget/nuget.exe should point to the nuget restore file you added to the repository.
Then in VSTS instead of using the default Nuget restore task, add a shell script task and point it to the shell script in your repository and the parameter should point to the solution file.
Just make sure your build server can also find the mono command.
I wrote this post explaining the solution in more detail:
Xamarin Build Services - Nuget Restore with VSTS
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With