uno: vs4mac: won't deploy / run / debug UNO applications for iOS, MacCatalyst, or MacOS
Current behavior
Uno iOS, MacCatalyst, or MacOS applications will not deploy, run, or debug from Visual Studio 2022 for Mac.
NOTES
- iOS apps will deploy, run and debug when launched from Visual Studio 2022 Windows that is paired to a Mac that won’t when running vs4mac.
- The following types of applications will deploy, run and debug from vs4mac:
- Xamarin: iOS, Mac
- Xamarin.Forms: iOS
- NET6.0: iOS, MacCatalyst, MacOS
- MAUI iOS, MacCatalyst, MacOS
- Have tried on two different Macs - one of which had a fresh install of xCode and vs4mac
- Have run
uno-checkon both Macs - Not sure if this correlates to most recent xCode update or most recent vs4mac update
Expected behavior
Well, eh, it works.
How to reproduce it (as minimally and precisely as possible)
On Mac:
- in terminal, execute the following: ‘dotnet new unoapp -o UnoApp’
- In vs4mac, open the solution created in the previous step
- Set the debug target to any one of the following:
- MacCatalyst
- MacOS
- iOS Simulator
- iOS device
- Build (should be successful)
- start a debug run
- see ‘Execution Failed’ message at the bottom left of Visual Studio window
- notice that there are no logs in Deploy window
Workaround
Please, please, please share one if you have one!
See thread, below, for work around!
Works on UWP/WinUI
No response
Environment
Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
NuGet package version(s)
All Platforms:
<PackageReference Include="Uno.WinUI" Version="4.6.19" />
<PackageReference Include="Uno.WinUI.RemoteControl" Version="4.6.19" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="4.6.19" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Uno.WinUI.Lottie" Version="4.6.19" />
iOS and MacCatalyst:
<PackageReference Include="Uno.Extensions.Logging.OSLog" Version="1.4.0" />
Affected platforms
iOS, macOS (AppKit), Mac Catalyst
IDE
Visual Studio for Mac
IDE version
VisualStudio 2022 for Mac, version 17.4 (2406)
Relevant plugins
No response
Anything else we need to know?
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 27 (27 by maintainers)
Sorry to hear Microsoft is giving up on VS4Mac. Thanks for keeping this in the backlog all this time.
@spouliot : sadly, iossimulator-x64 performance on an M2 MBP is still better than the android-arm64 performance on the same M2 MBP!
AN UPDATE
The past month or so, I’ve been working around this issue using the following workflow:
WORK AROUND : BUILD + DEBUGGING
In
[my_project].Mobile.csproj, replace the following:… with the following:
… where you will manually change which line to uncomment, depending on the target platform of your choice.
iOS
You may have to change to the following, depending if your debug target is an iOS simulator or a device:
SIMULATOR
Strange enough,
iossimulator-x64works on a M-Series Mac!?!?DEVICE
Also note, for iOS device debugs, I have to do a Rebuild All after any code change. If not, the linker gets all mucked up and I get a crash at launch from missing package references.
ANDROID
You may have to change to the following, depending if your debug target is an Android simulator (running on a x64 or M-Series Mac) or a device:
x64 SIMULATOR
DEVICE or M-Series Simulator
MacOS
MacCatalyst builds typically work as well as iOS builds do, but MacOS builds either won’t build or won’t deploy (so no debugging). When that happens, the following process seems to work:
globals.jsonthat are in the project’s folder hierarchy.vsfolders in the project’s folder hierarchy.vsconfigfiles in the project’s folder hierarchyNote: you might have to do this more than once if you have VSCode open. For good measure, repeat the above until you see
zsh: no matches found: **/objandzsh: no matches found: **/bin.WORK AROUND : ARCHIVE
Archive the iOS app from the command line by doing the following:
@spouliot : Thanks for the validation. Worth a million points of karma for the Uno team!
@baskren thanks for your detailed investigation. This is indeed issue https://github.com/dotnet/sdk/issues/21877 [1] and your workaround is correct, if sadly not ideal for day-to-day development.
IOW building for a single platform avoids the possible mixup between
-fand-rarguments which manifest themselves in different ways.AFAIK VSWin has it’s own
dotnet restore-like code which explains why this is not a problem when building projects from Windows.[1] https://github.com/xamarin/xamarin-macios/issues/16401 closed as a dupe of https://github.com/dotnet/sdk/issues/21877 only manifested itself when
net6.0-macoswas present, which MAUI does not support. It might be (part of) why this error is less common on MAUI, but there are other random factors too.