Steve Peschka
Steve Peschka

Reputation: 1371

Can't Connect to Mac After Upgrading Visual Studio to 17.4.0 Preview 1.0

I've been connecting to my MacBook Air for about three months now to do development with MAUI. I just upgraded Visual Studio 2022 from 17.3.0 Preview 3.0 to 17.4.0 Preview 1.0. Now the Connect to Mac is broken - the same connection I've been using.

The error message is "The Xcode license status couldn't be verified because Xcode has not been found on the default location of the connected Mac. Having Xcode installed and functional is necessary in order to build and run iOS apps, so please check that Xcode is installed and that the path specified under iOS Settings is correct."

Of course Xcode is installed because it's been working for some time. I found older posts that reported the same problem and have tried the fixes they suggested but to no avail. When I plug in a value in the Xcode Path in the VS settings, it doesn't save it. I can't find a way to go back to 17.3.0 Preview 3.0, so now that it's broken does anyone know how to fix it?

UPDATES

As I've continued to work on this problem, I've found this. First, if I close VS and reopen - WITHOUT OPENING MY PROJECT - and go into the Tools...Options...Xamarin...iOS Settings, I can a) put a path in the Xcode path property and then b) click on the Pair to Mac button and have it connect successfully (or so it says). So the settings look like this:

enter image description here

Then after I've connected it, it shows that I've paired to a Mac, as shown here:

enter image description here

Note that if I open my project when I start VS, it automatically tries to connect to the Mac and fails with the error above. But in this case, it shows it's connected to my Mac. So I open my project, and on the Debugger menu go to select a simulator from the iOS Simulators. But instead of showing all of the emulators available with Xcode on the Mac, it just says "Simulator", as shown here:

enter image description here

Now if I try and start debugging the application, it churns for a few seconds, and then stops with a message that says "An active connection to the Mac is required in order to launch the application. Please ensure the connection is established and try again". It then shows that I no longer have a connection to my Mac, as you see here:

enter image description here

If I select my Mac and click the Connect button again, then I get the same error message that I've described above, as shown here:

enter image description here

When I click on the OK button, it gives me another error message that says "The Xcode tools validation couldn't be performed because IDB has not been started successfully on the paired Mac, which is necessary in order to read the iOS Remote Settings. Having a non functional paired Mac or the Xcode tools not updated could cause unwanted behaviors. Please check the logs to see what happened with IDB initialization on the paired Mac." This is the dialog:

enter image description here

At this point, if I click the OK button again, I get yet a different message that says "The connection to the Mac has been lost in the middle of the process. Please try to connect again", as shown here:

enter image description here

Trying to connect from that point forward will fail every time with the error message previously described, "The Xcode license status couldn't be verified because Xcode has not been found on the default location of the connected Mac. Having Xcode installed and functional is necessary in order to build and run iOS apps, so please check that Xcode is correctly installed and that the path specified under iOS Settings is correct." If I close VS and start over again though, then I can repeat all of these steps and outcomes.

Upvotes: 9

Views: 3537

Answers (2)

uli1306
uli1306

Reputation: 133

Now it's 2025 and VS 17.12.4, but I still get this error. After hours I've seen that VS loses the setting "Xcode path" in Tools > Options > Xamarin > iOS Settings on VS application close.

This must be set to /Applications/Xcode.app

Then tried to pair again. This time the error "The Xcode license status couldn't be verified because Xcode has not been found on the default location of the connected Mac..." does not happen and the connection was successful.

So the Xcode path must be entered each time VS is started.

Maybe this helps someone.

Upvotes: 1

Jon
Jon

Reputation: 425

This solved the problem for me. It was an answer from Microsoft Support when I faced a similar issue with a .net 6.0 preview and solved the problem for me with the same issue in .net 7/VS 17.4.0 GA release:

Remove the /Users/USERNAME/Library/Caches/Xamarin/XMA/SDKs/dotnet folder on the MacOS build host, then add a global.json file to your project/solution folder on your Windows 10 development machine that explicitly specifies the exact SDK version without any roll forward strategy:

{
  "sdk": {
    "version": "7.0.100",
    "allowPrerelease": false,
    "rollForward": "disable"
  }
}

Finally connect to the MacOS build host again using the “Pair to Mac” dialog, which will then install the correct .NET SDK and also successfully install the correct workload on the MacOS build host.

Upvotes: 6

Related Questions