4

I am working on a Xamarin.Forms project with Visual Studio 2017 Professional with Windows machine. Also, I am using a Mac to build and run the iOS app by pairing the Mac with VS 2017. Sometimes Visual Studio on Mac is also used to build and run the app for both iOS and Android platforms of the same project and Macbook had Visual Studio 2017 for Mac.

Recently I had to restore the Macbook and reinstall the Xamarin development setup. Now the problem is if I install VS 2019 for Mac, it comes with Mono version 6.x.x and my VS 2017 on windows doesn't support that version as it always tells that there's a "Mono version mismatch" and asks to install Mono version 5.18.1, but VS 2019 for Mac does not support that version.

Then I downloaded VS 2017 for mac from the archive and did a fresh installation. After that, when I tried to pair mac with VS on Windows machine, it again notified the "Mono version mismatch" and installed mono 5.18.1. With that version, even a simple Xamarin.Forms project could not able to build on VS 2017 on Mac as it reports this error:

Getting restore information for project /Projects/Hello/Hello.iOS/Hello.iOS.csproj /Projects/Hello/Hello.iOS/Hello.iOS.csproj(153,3) : error MSB4019: The imported project "/Library/Frameworks/Mono.framework/Versions/5.18.1/lib/mono/xbuild/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. Unable to create package spec for project. /Projects/Hello/Hello.iOS/Hello.iOS.csproj

Tharindu
  • 386
  • 3
  • 17
  • Is your VS 2017 for window the latest? Try to update it. Also try to reinstall Xamarin.iOS. – nevermore Sep 27 '19 at 09:19
  • Yes, it has the latest update for VS 2017. I tried reinstalling Xamarin.iOS, but didn't help. I think I might have to update VS on both platforms to 2019 – Tharindu Sep 27 '19 at 13:06
  • What is the full version of Mono being used and what is the full VS Mac version? There was a change around Mono 5.18.1.24 to support later .NET Core sdks and a later MSBuild. The error you are seeing looks like a mismatch between the VS Mac v7 version and Mono's MSBuild - https://github.com/mono/mono/issues/14875#issuecomment-499998067 – Matt Ward Sep 29 '19 at 15:56
  • @MattWard yes the error comes because of a mismatch between the two VS versions. VS 2019 for Mac requires mono 6 or later, while VS 2017 on Windows requires exactly mono 5.18.1.28. So currently I keep Mono 5.18.1 in mac as it is to work on windows without any problem. – Tharindu Sep 30 '19 at 04:30
  • However, a Xamarin team member answered this exact question in this thread (https://forums.xamarin.com/discussion/comment/390475#Comment_390475). The most possible solution is to update VS in both platforms to 2019 the latest. – Tharindu Sep 30 '19 at 04:33
  • @JackHua-MSFT As I have looked, when I installed VS 2017 for mac, it comes with Mono 5.16.1 as I remember. So I think it doesn't support mono 5.18.1, and I can't update the Mac's VS 2017 to a specific update which supports mono 5.18.1. – Tharindu Sep 30 '19 at 04:38
  • 1
    Yep, try to use the latest version on both side. – nevermore Oct 01 '19 at 05:33

1 Answers1

0

Not the best solution, but updating Visual Studio on both platforms to 2019 solved the issue.

Tharindu
  • 386
  • 3
  • 17