Skip to content
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

MSBuild.Sdk.Extras cannot build the TargetFrameworks Xamarin.iOS and net6.0-ios together #291

Open
VincentUhlmann opened this issue May 20, 2022 · 6 comments

Comments

@VincentUhlmann
Copy link

Issue Description

A Binding Project for iOS based on MSBuild.Sdk.Extras.3.0.44 with the TargetFrameworks Xamarin.iOS and net6.0-ios throws the following error under Visual Studio 2022 for Mac when building: "If you are building projects that require targets from full MSBuild or MSBuildFrameworkToolsPath, you need to use desktop msbuild ('msbuild.exe') instead of 'dotnet build' or 'dotnet msbuild".

I also noticed that if I remove one of the target frameworks ( Xamarin.iOS / net6.0-ios) and change nothing else, the build works.

A Binding Project for Android based on MSBuild.Sdk.Extras.3.0.44 with the TargetFrameworks MonoAndroid and net6.0-android works fine under Windows in Visual Studio 2022. I'm not sure if this is a bug or the Visual Studio 2022 for Mac version just isn't ready yet. However, I can't find a way to build a Binding Project for these TargetFrameworks at the moment. But this is mandatory to make a plugin compatible between Xamarin and Maui.

Steps to Reproduce

Create a Binding Project in Visual Studio 2022 for Mac and set the TargetFrameworks Xamarin.iOS and net6.0-ios and specify the Project SDK to MSBuild.Sdk.Extras.3.0.44.

Try to build this.

Expected Behavior

The build works without error.

Actual Behavior

Error: If you are building projects that require targets from full MSBuild or MSBuildFrameworkToolsPath, you need to use desktop msbuild ('msbuild.exe') instead of 'dotnet build' or 'dotnet msbuild.

@m-sadegh-sh
Copy link

I'm getting the same error and found no way to get my machine into the previous working state. I've recently updated Visual Studio for Mac and since then, the build process is broken.

@m-sadegh-sh
Copy link

@VincentUhlmann Have you tried to enable MSBuild on macOS? This has fixed my issue!

@VincentUhlmann
Copy link
Author

@m-sadegh-sh Yes, one of my first steps was to enable MSBuild on Mac. However, the error remains the same whether I build in VS or in the console.

@nirinchev
Copy link

Did you folks come up with a workaround for this? We're in a similar position, trying to multitarget a project for Maui and Xamarin.iOS and are hitting this error.

@VincentUhlmann
Copy link
Author

VincentUhlmann commented May 17, 2023

@nirinchev Create two projects in the same solution: Foo.Maui, Foo.Xamarin that pointing to the same files. Only TargetFramework etc. are different then.

@nirinchev
Copy link

@VincentUhlmann thank you! I was hoping for something cleaner than that, but I guess there's not much that can be done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants