Skip to content

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

@Toine-db

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 @[email protected] 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    need-attentionAn issue requires our attention/response

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions