"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=""It continues to successfully compile.
It fails with error message:
[GetMinimumOSVersion] 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".
It was previously working with Visual Studio 16.7.7 but I don't recall the Xamarin.iOS version sadly.
Upon 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?
For the record I have also raised this issue on Stack Overflow and will update here accordingly if I get to an answer sooner.
Microsoft Visual Studio Professional 2019
Version 16.8.1
VisualStudio.16.Release/16.8.1+30711.63
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Professional
Visual C++ 2019 00435-60000-00000-AA092
Microsoft Visual C++ 2019
ASP.NET and Web Tools 2019 16.8.550.19892
ASP.NET and Web Tools 2019
ASP.NET Core Razor Language Services 16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c
Provides languages services for ASP.NET Core Razor.
ASP.NET Web Frameworks and Tools 2019 16.8.550.19892
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 16.8.550.19892
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 16.8.550.19892
Azure Functions and Web Jobs Tools
C# Tools 3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30924.1
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
Mono Debugging for Visual Studio 16.8.43 (00471f8)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 5.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
SQL Server Data Tools 16.0.62010.06180
Microsoft SQL Server Data Tools
TypeScript Tools 16.0.21016.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.8.0-5.20519.18+4c195c3ac1974edcefa76774d7a59a2350ec55fa
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Foo 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 16.8.000.255 (d16-8@d002176)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.8.0.507 (remotes/origin/d16-8@e87b24884)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.8.112 (86385a3)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 11.1.0.17 (d16-8/c0e2b8e)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: be2226b
Java.Interop: xamarin/java.interop/d16-8@79d9533
ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
SQLite: xamarin/sqlite/3.32.1@1a3276b
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc
Xamarin.iOS and Xamarin.Mac SDK 14.4.1.3 (e30c41de3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
This is a build log from our TeamCity build agent running the command mentioned in Steps to reproduce:
[XenplateDC.iOS\XenplateDC.iOS.csproj] _SayHello (14s)
[22:06:26][_SayHello] Executing SayHello Task to establish a connection to a Mac Server.
Properties:
SessionId=blanked,
ServerPort=,
ServerAddress=blanked,
ServerUser=blanked,
ServerPassword=,
SSHKey=,
SSHPassPhrase=,
AppName=XenplateDC.iOS,
VisualStudioProcessId=,
ContinueOnDisconnected=true
[22:06:26][_SayHello] SayHello (14s)
[22:06:26][SayHello] Connection Information for App 'XenplateDC.iOS'. Address: blanked, Port: 0, User: blanked
[22:06:26][SayHello] Connecting to Mac server blanked...
[22:06:41][XenplateDC.iOS\XenplateDC.iOS.csproj] _VerifyBuildSignature (2s)
[22:06:43][XenplateDC.iOS\XenplateDC.iOS.csproj] PrepareForBuild
[22:06:43][PrepareForBuild] MakeDir
[22:06:43][XenplateDC.iOS\XenplateDC.iOS.csproj] _GetMinimumOSVersion
[22:06:43][_GetMinimumOSVersion] GetMinimumOSVersion
[22:06:43][GetMinimumOSVersion] 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".
VS bug #1248227
This has broken our CI builds as well. Performing a rebuild within Visual Studio 2019 for the same configuration works fine however.
The msbuild command I've tried was
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" "<path to sln file>" /t:Rebuild "/p:Configuration=Ad-Hoc" "/p:Platform=iPhone" /p:ServerAddress=<ip> /p:ServerUser=<username> /p:ServerPassword=<password> /nr:false /v:m /p:RestorePackages=false /p:IpaPackageDir="<output path>"
Could you attach a diagnostic build log? The SDK version should default to the SDK version shipped with the Xcode you're using, and for some reason that doesn't seem to happen.
msbuild_output.txt
Here's the log of msbuild command with verbosity set to diagnostic level
@binesh1991 Thanks you beat me to it
The DetectSdkLocations task is where we find the default SDK version, but it seems there is a problem with the connection:
Task "DetectSdkLocations" (TaskId:44)
Task Parameter:SessionId=66c26c9cb20f009947a0e92e7e7df6f56b7b343165c2b3680d5554b422917028 (TaskId:44)
Task Parameter:TargetFrameworkMoniker=Xamarin.iOS,Version=v1.0 (TaskId:44)
Task Parameter:TargetArchitectures=ARM64 (TaskId:44)
DetectSdkLocations: 2020-11-18T13:27:56.2549670+05:30 - Started (TaskId:44)
DetectSdkLocations: 2020-11-18T13:27:56.2549670+05:30 - Initializing (TaskId:44)
[xma]: Trying to get a Build Connection for Session '66c26c9cb20f009947a0e92e7e7df6f56b7b343165c2b3680d5554b422917028': Xamarin.VisualStudio.Build.BuildConnection.66c26c9cb20f009947a0e92e7e7df6f56b7b343165c2b3680d5554b422917028, Lifetime: Build (TaskId:44)
[xma]: The Build Connection for Session '66c26c9cb20f009947a0e92e7e7df6f56b7b343165c2b3680d5554b422917028' is not active and needs to be connected with the proper host and user information (TaskId:44)
DetectSdkLocations: 2020-11-18T13:27:56.2639432+05:30 - Failed to initialize (TaskId:44)
Output Property: _SdkIsSimulator=False (TaskId:44)
Output Property: _IsXcode8=False (TaskId:44)
Done executing task "DetectSdkLocations". (TaskId:44)
@emaf can you have a look?
To add some more info, I have recreated this issue on two Mac build hosts running Xcode 12.2 and 12.0.1. Both Macs have latest VS 2019 for Mac installed.
I can confirm that I have the same entry in my log aside from different session ids obviously. Plus I am also running Xcode 12.2 and the latest VS2019 for Mac.
Hi all, I'm sorry about this problem, 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.
Please let us know if that unblocks your CI builds.
Thank you @emaf for the workaround. I'll stick with editing the Xamarin.iOS.Windows.After.targets file as that's the quickest option for me. I tried a new CI build (using Jenkins) after doing that but looks like msbuild is hanging after completion. Due to this, I had to terminate it manually from Task Manager for the rest of the build process to continue. So there's still some issue (probably this again).
Also @bijington, I think you're just doing a build (not rebuild) according to the command given? Anyway, it's better to post this workaround on Stack Overflow as well.
@emaf thank you for the speedy response! I can confirm that your workaround of modifying the targets file has worked for me.
@binesh1991 yes I will update Stack Overflow to cover the workaround for now.
Thanks for confirming the workaround worked!
@binesh1991 could you share a diagnostic build output after the build stops responding? The workaround shouldn't make that happen, or at least for a rebuild so we'd like to understand what's going on there.
I think that happened only for the first one after editing the file. The next two builds went through fine, so we can live with the workaround for the time being. Thanks!
Hi all, I'm sorry about this problem, 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.targetsand remove the_SayGoodbyeentry from theCleanDependsOnproperty group.Please let us know if that unblocks your CI builds.
@emaf How do you do this on mac?
Hi all, I'm sorry about this problem, 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.targetsand remove the_SayGoodbyeentry from theCleanDependsOnproperty group.Please let us know if that unblocks your CI builds.
@emaf How do you do this on mac?
@stesvis as far as I understand the problem it is only an issue when connecting from a Windows machine to a Mac. Therefore you only need to change the Xamarin file on your Windows machine
@stesvis as @bijington said this problem is only affecting Xamarin iOS builds on Windows, so there's no change needed on the Mac.
If you're facing the same error reported here from VS for Mac I'd suggest you report it as a separate issue because this problem is caused by a target that only runs on Windows so you may be facing a different problem.
Thanks!
@emaf and @bijington yes i have the same problem on Mac. I will open a new issue.
@xamarin-release-manager where can i find the new issue where this problem is beeing tracked?
@mclillill I am hoping this just means a new release with it fixed will be coming very soon
In my case on the Mac the problem was a corrupted Info.plist that I didn't notice (due to a merge).
Not sure why the error message was so off tho.
The issue on Windows has been fixed and will be available in the next 16.8 Service Release and 16.9 Preview. Thanks
Is it likely that these two reported issues will also be resolved with this fix?
https://developercommunity2.visualstudio.com/t/Error-MSB4044:-The-CheckSwiftVersionsTa/1252463?preview=true
https://developercommunity2.visualstudio.com/t/CheckSwiftVersionTask/1252846?preview=true
Looks like it's back in 16.8.3 and a developer has found a workaround that's posted at https://stackoverflow.com/a/65207950/2492114
Most helpful comment
Hi all, I'm sorry about this problem, 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.targetsand remove the_SayGoodbyeentry from theCleanDependsOnproperty group.Please let us know if that unblocks your CI builds.