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 · 0 comments
Open

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

mongosr opened this issue Jan 27, 2025 · 0 comments

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

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

1 participant