[dotnet] Show a clear error when PublishSingleFile is set. Fixes #16754#25978
[dotnet] Show a clear error when PublishSingleFile is set. Fixes #16754#25978rolfbjarne wants to merge 3 commits into
Conversation
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>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
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)istruefor Apple platforms. - Added a unit test ensuring the failure happens and the error message is user-friendly.
- Updated Copilot contribution guidance to prefer
-arm64runtime 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. |
…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>
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 |
This comment has been minimized.
This comment has been minimized.
🚀 [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 macOS tests✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
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
-arm64over-x64.Fixes #16754
🤖 Pull request created by Copilot