Visual Studio update (16.8.1) lead to CI build failures

Viewed 1246

We recently updated our build servers to using Visual Studio 16.8.1 and Xamarin.iOS 14.4.1.3 and have hit an issue with the previous MSBuild command that used to run.

For the record we are build a Xamarin Forms solution and targeting iOS here.

The command is:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\msbuild" MySolution.sln /p:Configuration="AppStore" /p:Platform="iPhone" /p:ServerAddress="" /p:ServerUser=""

I have tried searching for the specific error message that it is reporting (below) however I haven't been able to find anything useful so far.

C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Xamarin\iOS\Xamarin.Shared.targets(230,3): error MSB4044: The "GetMinimumOSVersion" task was not given a value for the required parameter "SdkVersion".

Update

Upon further digging I believe I have traced the source of the error back to these lines not being set in Xamarin.Shared.props.

<!-- SdkVersion -->
<_SdkVersion Condition="'$(_PlatformName)' == 'macOS'">$(MacOSXSdkVersion)</_SdkVersion>
<_SdkVersion Condition="'$(_PlatformName)' != 'macOS'">$(MtouchSdkVersion)</_SdkVersion>

I haven't been able to find out what sets MtouchSdkVersion and therefore why it isn't being set. A comment from just above the quoted section above states:

Sometimes we've used different variable names for the same thing for Xamarin.iOS and Xamarin.Mac projects. Here we try to unify those variables

Could it be that this unification has changed the behaviour of something that used to work?

2 Answers

This has reared it's head again in Visual Studio 2019 version 16.8.3. Looks like they've moved the problem to: <VS Install path>\MSBuild\Xamarin\iOS\Xamarin.Messaging.targets I was able to get my builds running again by removing the _SayGoodbye dependency on line 52 for the _DisconnectAfterClean target.

<Target Name="_DisconnectAfterClean" Condition="'$(IsRebuild)' != 'true'" DependsOnTargets="" />

This is certainly not a permanent solution to the problem but a workaround has been supplied by the Xamarin team. For reference the response is on GitHub

we're investigating it, but it looks like the build process is getting disconnected after running the clean targets, so if you run Build instead of Rebuild you shouldn't face this.

In the meantime, a potential workaround to unblock Rebuilds would be to edit <VS Install path>\MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets and remove the _SayGoodbye entry from the CleanDependsOn property group.

I can confirm that this has allowed our CI builds to operate again.

It should go without saying but I want to make it clear you should backup a copy of the Xamarin.iOS.Windows.After.targets file before doing this.

Related