Skip to content

Not able to build iOS binding library with XcodeProject items on Visual Studio (Windows) #23408

Open

Description

@Toine-db

Description

When creating an iOS binding library (using SwiftUI) there is no way to build it from a Windows device that is connected to a MAC. Always getting error: build a binding project from Windows unless a connection to a Mac is available (while connected to MAC)

On a MAC (with VSCode) the binding library works fine, using <XcodeProject... , when building the same project on Visual Studio (Windows) with a paired MAC there the project does not create good output, while is says the build succeeds.

When using MACCATALYST it gives a warning "It's currently not supported to build a binding project from Windows unless a connection to a Mac is available" but the build still succeeds. iOS doesn't give a warning at all.

The /bin output doesn't give proper output like a build on a MAC, ie: missing the @project@.resources folder with the SwiftUI project output.

Steps to Reproduce

  1. Create a very simple SwiftUI project
  2. Create a MAUI iOS binding project and implement the SwiftUI project, somthing like this:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net9.0-ios;net9.0-maccatalyst</TargetFrameworks>
    <Nullable>enable</Nullable>
    <ImplicitUsings>true</ImplicitUsings>
    <IsBindingProject>true</IsBindingProject>
    <IsTrimmable>true</IsTrimmable>
  </PropertyGroup>

  <ItemGroup>
    <ObjcBindingApiDefinition Include="ApiDefinitions.cs" />
    <ObjcBindingCoreSource Include="StructsAndEnums.cs" />
  </ItemGroup>

  <ItemGroup>
    <XcodeProject Include=".\WidgetKitProxy\WKP.xcodeproj">
      <SchemeName>WKP</SchemeName>  
    </XcodeProject>
  </ItemGroup>

</Project>
  1. Run/Test on MAC > this works
  2. Run/Test on Windows (where VS is attached to MAC) > this gives error message

Link to public reproduction project repository

No response

Version with bug

9.0.90 SR9
Dotnet workload 9.0.204 and 9.0.303

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

Xcode 16.4 - iOS 18.5

Did you find any workaround?

None, the only solution is to build it on a MAC and copy the output to Windows.

Relevant log output

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk.net9.0_18.4\18.4.9288\tools\msbuild\Xamarin.Shared.targets(1900,3): warning : It's currently not supported to build a binding project from Windows unless a connection to a Mac is available.

Activity

  1. similar-issues-ai commented on Jul 28, 2025

    @similar-issues-ai

    We've found some similar issues:

    If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

    Note: You can give me feedback by 👍 or 👎 this comment.

  2. transferred this issue fromdotnet/mauion Jul 28, 2025
  3. changed the title [-]While connected to MAC getting error: ...build a binding project from Windows unless a connection to a Mac is available.[/-] [+]Not able to build iOS binding library on Visual Studio (Windows)[/+] on Jul 29, 2025
  4. rolfbjarne commented on Aug 1, 2025

    @rolfbjarne
    Member

    Can you try adding this to your binding project and see if that makes it work?

    <PropertyGroup>
        <_RequiresMacConnection>true</_RequiresMacConnection>
    </PropertyGroup>
  5. added
    need-info
    on Aug 1, 2025
  6. added this to the Future milestone on Aug 1, 2025
  7. Toine-db commented on Aug 1, 2025

    @Toine-db
    Author

    @rolfbjarne Thanks for the suggestion.

    A day ago I updated Visual Studio and workloads due to Mac build host issues that were there before, but now I'm getting a different error message....so unfortunate. So I created a repo with an example that works great on MacOS en VSCode but doesnt on VisualStudio Windows 17.14.10 with workload 9.0.303.

    Still same result, not being able to build on Windows with a very simple XcodeProject framework library (or whatever its called).
    https://github.com/Toine-db/Maui.iOS.XcodeProjectExample

    Maybe this is a know issue for you?

    The error is now:
    clang++ exited with code 1:
    Undefined symbols for architecture arm64:
    "OBJC_CLASS$_WidgetCenterProxy", referenced from:
    in registrar.o
    "OBJC_CLASS$_WidgetInfoProxy", referenced from:
    in registrar.o
    ld: symbol(s) not found for architecture arm64
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)

    The build log for the iOS binding library with the <XcodeProject Include= ...

    Rebuild started at 16:28...
    1>------ Rebuild All started: Project: iOSBindings, Configuration: Debug Any CPU ------
    Restoring NuGet packages...
    To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the NuGet Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
    Restoring packages for D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\iOSBindings.csproj...
    Restoring packages for D:\repos\Maui.iOS.XcodeProjectExample\IosBindings.UiTests\IosBindings.UiTests.csproj...
    CACHE https://api.nuget.org/v3/vulnerabilities/index.json
    CACHE https://api.nuget.org/v3-vulnerabilities/2025.07.31.17.40.39/vulnerability.base.json
    CACHE https://api.nuget.org/v3-vulnerabilities/2025.07.31.17.40.39/2025.08.01.11.40.41/vulnerability.update.json
    Assets file has not changed. Skipping assets file writing. Path: D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\project.assets.json
    Restored D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\iOSBindings.csproj (in 12 ms).
    Assets file has not changed. Skipping assets file writing. Path: D:\repos\Maui.iOS.XcodeProjectExample\IosBindings.UiTests\obj\project.assets.json
    Restored D:\repos\Maui.iOS.XcodeProjectExample\IosBindings.UiTests\IosBindings.UiTests.csproj (in 38 ms).
    NuGet package restore finished.
    1>Build started 01/08/2025 16:28:11.
    1>Target Rebuild:
    1> Target _GenerateBuildSessionId:
    1> Using Session Id: d41ac9feaa185c168838a5f7c8f6ec3d983608be07b19a91ba2c97bf43c4f939
    1> Generated build app name: iOSBindings
    1> Required Agent: Build 18.5.9207
    1> Target _SayHello:
    1> Executing SayHello Task to establish a connection to a Remote Server.
    1> Properties:
    1> SessionId=d41ac9feaa185c168838a5f7c8f6ec3d983608be07b19a91ba2c97bf43c4f939,
    1> Addresss=192.168.2.24,
    1> SshPort=22,
    1> TcpPort=59610,
    1> User=userxincognito,
    1> AppName=iOSBindings,
    1> VisualStudioProcessId=37112,
    1> DotNetRuntimePath=/usr/local/share/dotnet/dotnet,
    1> ContinueOnDisconnected=False
    1> Creating a build connection for main App 'iOSBindings' and main Sessiond Id 'd41ac9feaa185c168838a5f7c8f6ec3d983608be07b19a91ba2c97bf43c4f939'
    1> Connection Information: Address: 192.168.2.24, SSH Port: 22, TCP Port: 59610, User: userxincognito
    1> Connecting to Mac server 192.168.2.24...
    1> Target CoreClean:
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-maccatalyst\IosBindings.resources.stamp".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-maccatalyst\IosBindings.dll".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-maccatalyst\IosBindings.pdb".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\iOSBindings.GeneratedMSBuildEditorConfig.editorconfig".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\iOSBindings.AssemblyInfoInputs.cache".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\iOSBindings.AssemblyInfo.cs".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\iOSBindings.csproj.CoreCompileInputs.cache".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\iOSBindings.sourcelink.json".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\IosBindings.dll".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\refint\IosBindings.dll".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\IosBindings.pdb".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\ref\IosBindings.dll".
    1> Target _CleanBindingResourcePackage:
    1> Directory "bin\Debug\net9.0-maccatalyst\IosBindings.resources" doesn't exist. Skipping.
    1> Target _CompileApiDefinitions:
    1> CompilerServer: tool - using command line tool by design 'C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\Roslyn\csc.exe' - Unnamed compilation 56f59bfd-62df-412c-88ae-0841d25303cb
    1> Target _GenerateBindings:
    1> Started external tool execution #2: dotnet.exe "C:/Program Files/dotnet/packs/Microsoft.MacCatalyst.Sdk.net9.0_18.5/18.5.9207//tools/lib/bgen\bgen.dll" "@d:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\response-file.rsp"
    1> Context Values: Base Path: /Users/userxincognito\Library\Caches\Xamarin\XMA, Logs Path: /Users/userxincognito\Library\Logs\Xamarin.Messaging-17.14.271, Local Base Path: C:\Users\userx\AppData\Local\Xamarin
    1> [xma][info]: MqttClient - Connected
    1> Target _CompressNativeFrameworkResources:
    1> Skipping target "_CompressNativeFrameworkResources" because it has no outputs.
    1> Target GenerateTargetFrameworkMonikerAttribute:
    1> Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
    1> Target CoreGenerateAssemblyInfo:
    1> Could not infer the type of parameter "#1" because the attribute type is unknown. The value will be treated as a string.
    1> Could not infer the type of parameter "#2" because the attribute type is unknown. The value will be treated as a string.
    1> Could not infer the type of parameter "#1" because the attribute type is unknown. The value will be treated as a string.
    1> Could not infer the type of parameter "#1" because the attribute type is unknown. The value will be treated as a string.
    1> Target _GenerateSourceLinkFile:
    1> Updating Source Link file 'obj\Debug\net9.0-maccatalyst\iOSBindings.sourcelink.json'.
    1> Target CoreClean:
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-ios\IosBindings.resources.stamp".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-ios\IosBindings.dll".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-ios\IosBindings.pdb".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\iOSBindings.GeneratedMSBuildEditorConfig.editorconfig".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\iOSBindings.AssemblyInfoInputs.cache".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\iOSBindings.AssemblyInfo.cs".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\iOSBindings.csproj.CoreCompileInputs.cache".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\iOSBindings.sourcelink.json".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\IosBindings.dll".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\refint\IosBindings.dll".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\IosBindings.pdb".
    1> Deleting file "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\ref\IosBindings.dll".
    1> Target _CleanMacBuild:
    1> Removing directory "bin\Debug\net9.0-ios".
    1> Removing directory "obj\Debug\net9.0-ios".
    1> CompilerServer: server - server processed compilation - iOSBindings (net9.0-maccatalyst)
    1> Target _CreateBindingResourcePackage:
    1> Creating "bin\Debug\net9.0-maccatalyst\IosBindings.resources.stamp" because "AlwaysCreate" was specified.
    1> Touching "bin\Debug\net9.0-maccatalyst\IosBindings.resources.stamp".
    1> Target _CleanBindingResourcePackage:
    1> Directory "bin\Debug\net9.0-ios\IosBindings.resources" doesn't exist. Skipping.
    1> Target _MapRuntimeIdentifierToTargetArchitecture:
    1> Target _CleanIntermediateToolOutput:
    1> Directory "obj\Debug\net9.0-ios\actool" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\assetpacks" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\codesign" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\coremlc" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\ibtool" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\ibtool-link" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\ibtool-manifests" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\ipa" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\metal" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\optimized" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\scntool" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\TextureAtlas" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\mtouch-cache" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios" doesn't exist. Skipping.
    1> Target CopyFilesToOutputDirectory:
    1> Copying file from "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\IosBindings.dll" to "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-maccatalyst\IosBindings.dll".
    1> Copying reference assembly from "obj\Debug\net9.0-maccatalyst\refint\IosBindings.dll" to "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\ref\IosBindings.dll".
    1> iOSBindings -> D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-maccatalyst\IosBindings.dll
    1> Copying file from "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-maccatalyst\IosBindings.pdb" to "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-maccatalyst\IosBindings.pdb".
    1> Target _GenerateHotRestartBuildSessionId:
    1> Using Session Id: d41ac9feaa185c168838a5f7c8f6ec3d983608be07b19a91ba2c97bf43c4f939
    1> Generated build app name: iOSBindings
    1> Required Agent: Build 18.5.9207
    1> Target _CleanHotRestartBundle:
    1> Directory "C:\Users\userx\AppData\Local\Temp\Xamarin\HotRestart\Signing\IosBindings.app\out" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\UnpackedFrameworks" doesn't exist. Skipping.
    1> Directory "obj\Debug\net9.0-ios\DynamicFrameworks" doesn't exist. Skipping.
    1> Target MaciOSPrepareForBuild:
    1> Creating directory "obj\Debug\net9.0-ios\stamp".
    1> Target PrepareForBuild:
    1> Creating directory "bin\Debug\net9.0-ios".
    1> Creating directory "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\refint".
    1> Creating directory "obj\Debug\net9.0-ios\ref".
    1> Target _CompileApiDefinitions:
    1> CompilerServer: tool - using command line tool by design 'C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\Roslyn\csc.exe' - Unnamed compilation f943885f-f15c-4e01-873e-b58995f3d016
    1> Target _GenerateBindings:
    1> Creating directory "obj\Debug\net9.0-ios\iOS".
    1> Started external tool execution #1: dotnet.exe "C:/Program Files/dotnet/packs/Microsoft.iOS.Sdk.net9.0_18.5/18.5.9207//tools/lib/bgen\bgen.dll" "@d:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\response-file.rsp"
    1> Target _CompressNativeFrameworkResources:
    1> Skipping target "_CompressNativeFrameworkResources" because it has no outputs.
    1> Target CoreGenerateAssemblyInfo:
    1> Could not infer the type of parameter "#1" because the attribute type is unknown. The value will be treated as a string.
    1> Could not infer the type of parameter "#2" because the attribute type is unknown. The value will be treated as a string.
    1> Could not infer the type of parameter "#1" because the attribute type is unknown. The value will be treated as a string.
    1> Could not infer the type of parameter "#1" because the attribute type is unknown. The value will be treated as a string.
    1> Target _GenerateSourceLinkFile:
    1> Updating Source Link file 'obj\Debug\net9.0-ios\iOSBindings.sourcelink.json'.
    1> Target CoreCompile:
    1> CompilerServer: server - server processed compilation - iOSBindings (net9.0-ios)
    1> Target _DetectSdkLocations:
    1> Using the Xcode location configured for this system (found using 'xcode-select -p'): /Applications/Xcode_16.4.app
    1> Found Xcode, version 16.4 (23792).
    1> Target _CreateBindingResourcePackage:
    1> Creating "bin\Debug\net9.0-ios\IosBindings.resources.stamp" because "AlwaysCreate" was specified.
    1> Touching "bin\Debug\net9.0-ios\IosBindings.resources.stamp".
    1> Target CopyFilesToOutputDirectory:
    1> Copying file from "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\IosBindings.dll" to "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-ios\IosBindings.dll".
    1> Copying reference assembly from "obj\Debug\net9.0-ios\refint\IosBindings.dll" to "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\ref\IosBindings.dll".
    1> iOSBindings -> D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-ios\IosBindings.dll
    1> Copying file from "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\obj\Debug\net9.0-ios\IosBindings.pdb" to "D:\repos\Maui.iOS.XcodeProjectExample\IosBindings\bin\Debug\net9.0-ios\IosBindings.pdb".
    1> Target _SayGoodbye:
    1> Build signature: build-51b26c53-4f95-4705-951c-df354bf1b9d7
    1> [xma][info]: Uploading 'signature' (0/0 KB) 100,00%...
    1> [xma][info]: MqttClient - Disconnected.
    1>
    1>Build succeeded.
    1> 0 Warning(s)
    1> 0 Error(s)
    1>
    1>Time Elapsed 00:00:03.46
    ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
    ========== Rebuild completed at 16:28 and took 04,178 seconds ==========

  8. added
    need-attention
    and removed
    need-info
    on Aug 1, 2025
  9. rolfbjarne commented on Aug 7, 2025

    @rolfbjarne
    Member

    I can reproduce the problem, the _RequiresMacConnection property doesn't fully work.

    As a workaround, build the Xcode project on the mac, and then include the Xcode outputs as NativeReference items in the binding project file instead (of using XcodeProject items to have the .NET build automatically build the Xcode project).

  10. added
    msbuild
    windows-only
    bug
    and removed
    need-attention
    on Aug 7, 2025
  11. modified the milestones: Future, .NET 10 on Aug 7, 2025
  12. modified the milestones: .NET 10, .NET 11 on Oct 22, 2025
  13. changed the title [-]Not able to build iOS binding library on Visual Studio (Windows)[/-] [+]Not able to build iOS binding library with XcodeProject items on Visual Studio (Windows)[/+] on Sep 4, 2026
  14. modified the milestones: .NET 11, .NET 12 on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmsbuildwindows-only

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions