-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot build iOS binding library from the command line on Windows with msbuild #27098
Comments
The MAUI UI team doesn't maintain this tooling, I believe that belongs in xamarin-macios. I'm unsure if it is possible to build a .NET binding library with msbuild, I think you would need to use |
Hello everyone, I think I found a solution for my problem. I installed dotnet-sdk-8.0.404-osx-x64.pkg on both macs, then did a sudo dotnet workload install maui --source https://api.nuget.org/v3/index.json on both machines and all of a sudden, I can build using msbuild on the windows command line. That doesn't explain why interactive builds using visual studio after pairing with the mac worked without it (can someone explain please?), but it is sufficient for me to work. So I would be happy if someone explained these weird circumstances, otherwise please close this ticket. Thank you everyone, -- |
using dotnet build on windows doesn't work, because it does not create a paired connection to the Mac, at least I could not find a way to do so from windows. |
Correct,
Yes,
like this:
Note that the command-line build won't automatically install anything on Mac, the correct version of .NET + the iOS workload must already be installed. The easiest way to accomplish this is to connect to the Mac from VS first, and build once (any iOS project). There's some more information here: https://learn.microsoft.com/en-us/dotnet/maui/ios/pair-to-mac?view=net-maui-9.0#build-ios-apps-from-the-windows-command-line |
This works like a charm, thank you so much for sharing this. -- |
Description
I have an iOS binding library targetting .NET 8 and I cannot build it successfully from the Windows command line. I can successfully build this library using Visual Studio 2022 (after having successfully paired with my Mac) and I can build it successfully on the mac itself using dotnet build, but building from the windows command line using msbuild.exe fails. My binding library is a P/Invoke Wrapper around a .a file (a fat library). I am using Visual Studio 2022 17.12.3 on Windows and I can reproduce this behaviour with two different MACs, one running with XCode 15.4 and the other with XCode 16.0. I could also reproduce this problem with an iOS binding library for .NET 9.
I am building like so on the command line:
msbuild.exe myIOSBindProj.sln /p:ServerAddress=%MAC_HOST% /p:ServerUser=%MAC_USER% /p:Configuration=Debug "/p:Platform=Any CPU" /t:Rebuild /v:diag
This assumes the solution file to be myIOSBindProj.sln and the user and computer name for the Mac to be in environment variables MAC_USER and MAC_HOST.
If I do this, the build will fail and the error (output shown in red) will be:
What is different here between the build via msbuild.exe and Visual Studio itself?
dotnet workload list tells me this:
Any help appreciated,
--
Stefan
Steps to Reproduce
msbuild.exe myIOSBindProj.sln /p:ServerAddress=%MAC_HOST% /p:ServerUser=%MAC_USER% /p:Configuration=Debug "/p:Platform=Any CPU" /t:Rebuild /v:diag
Link to public reproduction project repository
No response
Version with bug
Unknown/Other
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS
Did you find any workaround?
I have no workaround for this, because this should be working from an automated build and in the Xamarin days this worked when building a Xamarin iOS binding library via msbuild.
Relevant log output
The text was updated successfully, but these errors were encountered: