Skip to content

[dotnet] Show a clear error when PublishSingleFile is set. Fixes #16754#25978

Open
rolfbjarne wants to merge 3 commits into
mainfrom
dev/rolf/publish-single-file-error
Open

[dotnet] Show a clear error when PublishSingleFile is set. Fixes #16754#25978
rolfbjarne wants to merge 3 commits into
mainfrom
dev/rolf/publish-single-file-error

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

PublishSingleFile is not supported for .NET Apple platforms. Previously,
setting this property would result in a cryptic error from the
GenerateBundle task. Now we show a clear error message explaining that
single-file publishing is not supported.

Also adds a note to copilot-instructions.md that new test cases should
prefer -arm64 over -x64.

Fixes #16754

🤖 Pull request created by Copilot

rolfbjarne and others added 2 commits July 8, 2026 20:51
PublishSingleFile is not supported for .NET Apple platforms. Previously,
setting this property would result in a cryptic error from the
GenerateBundle task. Now we show a clear error message explaining that
single-file publishing is not supported.

Fixes #16754

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Update the PublishSingleFile test to use -arm64 runtime identifiers
instead of -x64. Add a note to copilot-instructions.md that new test
cases should prefer -arm64 over -x64.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review July 9, 2026 08:19
Copilot AI review requested due to automatic review settings July 9, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves developer experience for .NET Apple platform projects by proactively failing with a clear MSBuild error when PublishSingleFile=true is set (since single-file publishing isn’t supported), instead of letting a later/cryptic GenerateBundle error surface.

Changes:

  • Added an MSBuild validation target that errors when $(PublishSingleFile) is true for Apple platforms.
  • Added a unit test ensuring the failure happens and the error message is user-friendly.
  • Updated Copilot contribution guidance to prefer -arm64 runtime identifiers in new test cases.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/dotnet/UnitTests/ProjectTest.cs Adds a regression test asserting PublishSingleFile=true fails with a clear error.
dotnet/targets/Xamarin.Shared.Sdk.targets Introduces _ValidatePublishSingleFile to emit a friendly error before build/publish.
.github/copilot-instructions.md Documents a testing guideline to prefer -arm64 RIDs when adding new tests.

Comment thread tests/dotnet/UnitTests/ProjectTest.cs Outdated
…first one

Build log error ordering isn't guaranteed, so relying on errors[0]
can be flaky. Check that any error in the list contains the expected
message instead.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rolfbjarne rolfbjarne enabled auto-merge (squash) July 9, 2026 08:31
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 3ec0b30cb2153a3c4dcbadb19c94935bdec71d4b [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #3ec0b30] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 199 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 17 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 3ec0b30cb2153a3c4dcbadb19c94935bdec71d4b [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error building net7-macos target with PublishSingleFile

3 participants