Repository navigation
[macOS] dotnet publish fails when using AdditionalAppExtensions #19432
Copy link
Copy link
Open
Labels
app-extensionsbugIf an issue is a bug or a pull request a bug fixIf an issue is a bug or a pull request a bug fix
Milestone
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
<ItemGroup>
<AdditionalAppExtensions Include="../native">
<Name>ShareExtension Mac</Name>
<BuildOutput>build/$(Configuration)</BuildOutput>
</AdditionalAppExtensions>
</ItemGroup>
xcodebuild -project ../native/app.xcodeproj -configuration Release -target "ShareExtension Mac"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.
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
app-extensionsbugIf an issue is a bug or a pull request a bug fixIf an issue is a bug or a pull request a bug fix
Activity
rolfbjarne commentedon Nov 13, 2023
Are you setting
ArchiveOnBuild=truein 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 theCreatePackageproperty).tipa commentedon Nov 13, 2023
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 thenrolfbjarne commentedon Nov 14, 2023
ArchiveOnBuild=truewill 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 setArchiveOnBuild.It's still a bug that should be fixed, so I'll keep it open.
tipa commentedon Nov 25, 2023
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: #14872Is there a workaround to generate debug symbols without having to use
ArchiveOnBuild?rolfbjarne commentedon Nov 30, 2023
Can you try setting
NoDSymUtil=false?