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

dotnet publish - Missing Binaries in IPA or Linker Errors #22064

Open
mongosr opened this issue Jan 27, 2025 · 4 comments
Open

dotnet publish - Missing Binaries in IPA or Linker Errors #22064

mongosr opened this issue Jan 27, 2025 · 4 comments
Labels
need-info Waiting for more information before the bug can be investigated
Milestone

Comments

@mongosr
Copy link

mongosr commented Jan 27, 2025

Apple platform

iOS

Framework version

net8.0-*

Affected platform version

.NET 8.0.402 / XCode 16.2 and 15.4

Description

We have a peripheral for which we have a bindings nuget package. We reference the bindings nuget package from a project that is an iOS library. We also have a simulator project we use on simulators. We conditionally reference the simulator project when the runtime identifier is the simulator. Otherwise, we reference the ios project.

Maui App Project:

<ItemGroup Condition="$(RuntimeIdentifier.Contains('ios')) and $(RuntimeIdentifier.Contains('simulator')) ">
        <ProjectReference Include="..\SimulatedClassLibrary\SimulatedClassLibrary.csproj" />
 </ItemGroup>
    
<ItemGroup Condition="$(RuntimeIdentifier.Contains('ios')) and !$(RuntimeIdentifier.Contains('simulator'))">
        <ProjectReference Include="..\NativeLibrary\NativeLibrary.csproj"/>    
<!— <PackageReference Include="ObjcTestFramework" Version="1.0.0.3”/> —>
</ItemGroup>

Using the command line
dotnet publish $BASE_DIR/BindingTestApp/BindingTestApp.csproj -f net8.0-ios -r ios-arm64 -c Release -p:ArchiveOnBuild=true -p:CodesignKey="Apple Development: Key" --no-restore --output $OUT_DIR --verbosity Detailed

The above setup causes a linker error saying that the ios framework objc class method doesn’t exist for arm64. The ObjcTestFramework dll and ObjcTestFramework.resources library is missing in the bin/release folder for the Maui app

If I uncomment the PackageReference, then dotnet publish succeeds, and the ipa is generated. However, the ObjcTestFramework.dll and ObjcTestFramework.resources directory are missing in the IPA. This causes a runtime error.

We would expect the configured references above to generate an IPA with the binding project dll, ObjcTestFramework, and the ios framework included. We would not expect any linker errors nor would we expect the ObjcTestFramework dll and ios framework to be missing in the Maui app bin/release directory.

Steps to Reproduce

I have attached sample projects, solutions, and scripts that re-creates the issue.

Adjust scripts for code signing keys, directories, etc.

Update projects and nuget.config for local repo

Execute BuilsFrameworks.sh
Execute CreateNugets.sh
Execute BuildIpa.sh

This causes a linker error complaining about the native objective c class and method missing for arm 64

In BuildTestApp.csproj, uncomment the PackageReference

<ItemGroup Condition="$(RuntimeIdentifier.Contains('ios')) and !$(RuntimeIdentifier.Contains('simulator'))">
        <ProjectReference Include="..\NativeLibrary\NativeLibrary.csproj"/>    
<PackageReference Include="ObjcTestFramework" Version="1.0.0.3”/>
</ItemGroup>

Re-run BuildIpa.sh

The build will succeed and the ipa will generate. However, the IPA will be missing the binding library ObjcTestFramework.dll and the native framework usually stored under ObjcTestFramework.resources

Did you find any workaround?

No. We have tried tons of things wil no luck.

Build logs

No response

@rolfbjarne
Copy link
Member

I have attached sample projects, solutions, and scripts that re-creates the issue.

There are no attachments here - could you try attaching them again?

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Feb 10, 2025
@rolfbjarne rolfbjarne added this to the Future milestone Feb 10, 2025
@mongosr
Copy link
Author

mongosr commented Feb 10, 2025

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Feb 10, 2025
@rolfbjarne
Copy link
Member

Can you try adding a reference to the NuGet in your BindingTestApp.csproj:

<ItemGroup>
    <PackageReference Include="ObjcTestFramework" Version="1.0.0.3" />
</ItemGroup>

and see if that fixes the problem?

@rolfbjarne rolfbjarne added need-info Waiting for more information before the bug can be investigated and removed need-attention An issue requires our attention/response labels Feb 13, 2025
Copy link
Contributor

Hi @mongosr. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-info Waiting for more information before the bug can be investigated
Projects
None yet
Development

No branches or pull requests

2 participants