Skip to content

[macOS] dotnet publish fails when using AdditionalAppExtensions #19432

Open

Description

@tipa

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

  <ItemGroup>
    <AdditionalAppExtensions Include="../native">
      <Name>ShareExtension Mac</Name>
      <BuildOutput>build/$(Configuration)</BuildOutput>
    </AdditionalAppExtensions>
  </ItemGroup>
  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, but for macOS

Activity

  1. rolfbjarne commented on Nov 13, 2023

    @rolfbjarne
    Member

    Are you setting ArchiveOnBuild=true in your project file? If so, can you try disabling it instead (ArchiveOnBuild=false)? Note that you'll still get a pkg (that's controlled by the CreatePackage property).

  2. added
    need-infoWaiting for more information before the bug can be investigated
    on Nov 13, 2023
  3. added this to the Future milestone on Nov 13, 2023
  4. tipa commented on Nov 13, 2023

    @tipa
    Author

    Yes I was using ArchiveOnBuild=true. Removing it fixed the problem. I was under the impression that this property was required, maybe it was in the past. So perhaps this issue can be closed then

  5. added
    need-attentionAn issue requires our attention/response
    and removed
    need-infoWaiting for more information before the bug can be investigated
    on Nov 13, 2023
  6. rolfbjarne commented on Nov 14, 2023

    @rolfbjarne
    Member

    Yes I was using ArchiveOnBuild=true. Removing it fixed the problem. I was under the impression that this property was required, maybe it was in the past.

    ArchiveOnBuild=true will make us create an xcarchive in ~/Library/Developer/Xcode/Archives, which will show up in Xcode. If you don't need that, you don't need to set ArchiveOnBuild.

    So perhaps this issue can be closed then

    It's still a bug that should be fixed, so I'll keep it open.

  7. added
    bugIf an issue is a bug or a pull request a bug fix
    and removed
    need-attentionAn issue requires our attention/response
    on Nov 14, 2023
  8. modified the milestones: Future, .NET 9 on Nov 14, 2023
  9. tipa commented on Nov 25, 2023

    @tipa
    Author

    I now remember why I have used ArchiveOnBuild=true - to generate Debug Symbols that I could upload to AppCenter. I added it after this discussion: #14872
    Is there a workaround to generate debug symbols without having to use ArchiveOnBuild?

  10. rolfbjarne commented on Nov 30, 2023

    @rolfbjarne
    Member

    Can you try setting NoDSymUtil=false?

  11. modified the milestones: .NET 9, .NET 10 on Sep 27, 2024
  12. modified the milestones: .NET 10, .NET 11 on Oct 22, 2025
  13. modified the milestones: .NET 11, .NET 12 on Sep 1, 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

    app-extensionsbugIf an issue is a bug or a pull request a bug fix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions