Repository navigation
[msbuild] Embed app extensions even when ReferenceOutputAssembly is false. Fixes #26453 - #26476
Conversation
…alse. Fixes #26453 The `_ResolveAppExtensionReferences` target only added a referenced app extension to `_ResolvedAppExtensionReferences` when the project reference didn't have `ReferenceOutputAssembly=false`. The `MSBuild` task itself was executed unconditionally, so the app extension was still built - it just never made it into the container app's `PlugIns` directory. The build succeeded with no errors and no warnings, which made this very hard to diagnose. `ReferenceOutputAssembly=false` means "don't reference the output assembly of this project reference from the compiler", which is exactly what you'd want for an app extension (the container app never compiles against the extension's code - they're separate processes). It says nothing about whether the extension should be embedded in the container app, so it shouldn't affect the embedding at all. This condition dates back to when app extension support was first added (xamarin/maccore@71e3bae), and there doesn't seem to be any reason for it, so just remove it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 57a20054-5162-48cd-97a2-58bceaa09807
…ssembly=false Verified that this test fails without the previous commit's fix, and passes with it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 57a20054-5162-48cd-97a2-58bceaa09807
…putAssembly=false The '_ResolveAppExtensionReferences' target has two <MSBuild> invocations, and both had the bug. The existing test only covers the one that builds the referenced extension projects, since '_BuildReferencedExtensionProjects' defaults to true, so add a test for the other one as well (which is the code path some versions of the IDE take). Verified that this test fails if the fix is reverted. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 57a20054-5162-48cd-97a2-58bceaa09807
There was a problem hiding this comment.
Pull request overview
This PR fixes a silent packaging bug in the MSBuild app-extension embedding pipeline: app extension project references marked with ReferenceOutputAssembly=false are now still included in _ResolvedAppExtensionReferences, so the container app embeds the produced .appex under PlugIns/ as intended.
Changes:
- Remove
ReferenceOutputAssembly != falsefiltering when collecting app extension bundle paths from the_ResolveAppExtensionReferencestarget. - Add unit test coverage for
ReferenceOutputAssembly=falsefor both_ResolveAppExtensionReferencesMSBuild code paths (prebuilt vs built-as-part-of-container build). - Add a test-only
ProjectReferencemetadata hook in theExtensionConsumertest project to toggleReferenceOutputAssemblyfrom tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| msbuild/Xamarin.Shared/Xamarin.Shared.targets | Ensures app extension bundle outputs are captured regardless of ReferenceOutputAssembly, enabling embedding into the container app. |
| tests/dotnet/UnitTests/ProjectTest.cs | Adds regression tests to verify extensions are embedded even when ReferenceOutputAssembly=false, including the “prebuilt extension” path. |
| tests/dotnet/ExtensionConsumer/shared.csproj | Adds conditional ReferenceOutputAssembly metadata to enable the new regression tests. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
🚀 [CI Build #5724cdf] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 264 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
The
_ResolveAppExtensionReferencestarget only added a referenced appextension to
_ResolvedAppExtensionReferenceswhen the project referencedidn't have
ReferenceOutputAssembly=false. TheMSBuildtask itself wasexecuted unconditionally, so the app extension was still built - it just never
made it into the container app's
PlugInsdirectory. The build succeeded withno errors and no warnings, which made this very hard to diagnose.
ReferenceOutputAssembly=falsemeans "don't reference the output assembly ofthis project reference from the compiler", which is exactly what you'd want for
an app extension (the container app never compiles against the extension's code
should be embedded in the container app, so it shouldn't affect the embedding at
all.
This condition dates back to when app extension support was first added
(xamarin/maccore@71e3baeeb2d8d8421b0d67943e0925ea2916cc60), and there doesn't
seem to be any reason for it, so just remove it.
The target has two
MSBuildinvocations, and both had the same problem, sothere's a test for each of them (one for when we build the referenced extension
projects, and one for when they've already been built). Both tests were verified
to fail without the fix.
Fixes #26453
🤖 Pull request created by Copilot