dotnet / dotnet/macios

[macOS] dotnet publish fails when using AdditionalAppExtensions

Open
#19,432 5 comments 0 reactions 0 assignees View on GitHub
app-extensions bug
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

I tried to add a macOS Share Extension written in Swift to my macOS app. Debugging works, but it errors out when trying to create the `.pkg` file

### Steps to Reproduce

```


ShareExtension Mac
build/$(Configuration)


```

1. `xcodebuild -project ../native/app.xcodeproj -configuration Release -target "ShareExtension Mac"`
2. `dotnet publish -v diag`

### Expected Behavior
App builds and produces `.pkg` file

### Actual Behavior

```
20:24:34.660 1:7>Done building target "_CreateInstaller" in project "App.macOS.csproj".: (TargetId:715)
Target "Codesign" skipped. Previously built successfully.
20:24:34.661 1:7>Target "_CoreArchive: (TargetId:716)" in file "/usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/14.0.8477-net8-rc2.2/tools/msbuild/macOS/Xamarin.Shared.targets" from project "/Users/me/GitHub/app/App.macOS/App.macOS.csproj" (target "Archive" depends on it):
Task "Error" skipped, due to false condition; ('$(_CodeSigningKey)' == '' And '$(_PlatformName)' != 'macOS' And '$(_PlatformName)' != 'MacCatalyst') was evaluated as ('XXXXXXXXXX' == '' And 'macOS' != 'macOS' And 'macOS' != 'MacCatalyst').
Task "CollectITunesSourceFiles" skipped, due to false condition; ('$(IsMacEnabled)' == 'true' And '@(_ITunesSourceFile)' == '' And '$(_PlatformName)' != 'macOS' And '$(_PlatformName)' != 'MacCatalyst') was evaluated as ('true' == 'true' And '' == '' And 'macOS' != 'macOS' And 'macOS' != 'MacCatalyst').
Using "Archive" task from assembly "/usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/14.0.8477-net8-rc2.2/tools/msbuild/macOS/Xamarin.Mac.Tasks.dll".
Task "Archive" (TaskId:439)
Task Parameter:SigningKey=XXXXXXXXXX (TaskId:439)
Task Parameter:CustomBundleName=MonoBundle (TaskId:439)
Task Parameter:TargetFrameworkMoniker=.NETCoreApp,Version=v8.0,Profile=macos (TaskId:439)
Task Parameter:ProjectName=App.macOS (TaskId:439)
Task Parameter:OutputPath=bin/Release/net8.0-macos/ (TaskId:439)
Task Parameter:
AppExtensionReferences=
../native/build/Release/ShareExtension Mac.appex
ContainerName=PlugIns (TaskId:439)
Task Parameter:SolutionPath=*Undefined* (TaskId:439)
Task Parameter:AppBundleDir=bin/Release/net8.0-macos/App.app (TaskId:439)
20:24:34.834 1:7>/usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/14.0.8477-net8-rc2.2/tools/msbuild/macOS/Xamarin.Shared.targets(2824,3): error : Could not find file '/Users/me/GitHub/app/native/build/Release/ShareExtension Mac.appex/Info.plist'. [/Users/me/GitHub/app/App.macOS/App.macOS.csproj]
Done executing task "Archive" -- FAILED. (TaskId:439)
20:24:34.846 1:7>Done building target "_CoreArchive" in project "App.macOS.csproj" -- FAILED.: (TargetId:716)
20:24:34.846 1:7>Done Building Project "/Users/me/GitHub/app/App.macOS/App.macOS.csproj" (Publish target(s)) -- FAILED.
```

https://github.com/xamarin/xamarin-macios/blob/b0979416abee65b0a5085069945b8d91b5edc93d/msbuild/Xamarin.Shared/Xamarin.Shared.targets#L2824-L2842

It appears as if the build looks for the Info.plist file in the appex root directory, but it is located in the `Contents` subfolder

### Environment
.NET8 RC 2.2

Version information

```
Visual Studio Community 2022 for Mac
Version 17.6.6 (build 408)
Installation UUID: bb404628-8e0a-4c1f-8e58-49521e4c232a

Runtime
.NET 7.0.3 (64-bit)
Architecture: Arm64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/8.0.100-rc.2.23502.2/Sdks
SDK Versions:
8.0.100-rc.2.23502.2
7.0.310
7.0.304
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
8.0.0-rc.2.23479.6
7.0.13
7.0.7

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Xamarin.Android
Not Installed

Microsoft Build of OpenJDK
Java SDK: Not Found

Eclipse Temurin JDK
Java SDK: Not Found

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2023-10-23 17:41:04 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2023-10-23 17:41:04 UTC

Apple Developer Tools
Xcode: 15.0.1 22266
Build: 15A507

Xamarin.Mac
Version: 9.3.0.18 Visual Studio Community
Hash: 9d266025e
Branch: xcode14.3
Build date: 2023-09-06 19:52:26-0400

Xamarin.iOS
Version: 16.4.0.18 Visual Studio Community
Hash: 9d266025e
Branch: xcode14.3
Build date: 2023-09-06 19:52:27-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2023-10-23 17:41:00 UTC

Build Information
Release ID: 1706060408
Git revision: 3912eca6712af97335aa3a782abaa75ff86ec74a
Build date: 2023-10-23 17:39:03+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 13.6.0
Darwin 22.6.0 Darwin Kernel Version 22.6.0
Fri Sep 15 13:41:30 PDT 2023
root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T8103 arm64

```

### Build Logs
If needed, I can provide a `binlog` in a private message

### Example Project (If Possible)

I have basically created an extension project very similar to the iOS extension project I have shared [here](https://github.com/xamarin/xamarin-macios/issues/8933#issuecomment-1772981599), but for macOS

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.