Repository navigation
Emit more descriptive error when running .NET Framework exe on non-Windows - #54581
Merged
Merged
Conversation
Contributor
📋 SDK Diagnostic Documentation ReminderThis PR introduces 1 new SDK diagnostic code:
Action RequiredPlease ensure that documentation for this diagnostic is added or updated in the dotnet/docs repository at:
Each diagnostic should have:
Thank you for helping keep our documentation up to date! 🙏 |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a clearer, localized SDK error for dotnet run when attempting to run a .NET Framework executable on non-Windows platforms (where the SDK does not provide a default RunCommand), aligning with the scenario discussed in #51953.
Changes:
- Introduces a new MSBuild validation target that emits
NETSDK1241for unsupported.NETFrameworkrun scenarios on non-Windows whenRunCommandisn’t set. - Adds the new
RunCommandRequiresWindowsForNetFrameworkresource string (with localized XLF entries). - Adds a non-Windows-only regression test validating that
dotnet runsurfacesNETSDK1241.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/Microsoft.NET.Build.Tests/GivenThatWeWantToRunADesktopExeOnNonWindows.cs | Adds coverage ensuring dotnet run fails with NETSDK1241 for net472 executables on non-Windows. |
| src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets | Adds _CheckRunCommandSupported target to emit the new descriptive error after ComputeRunArguments. |
| src/Tasks/Common/Resources/Strings.resx | Adds the RunCommandRequiresWindowsForNetFramework (NETSDK1241) error message and updates the “latest message added” marker. |
| src/Tasks/Common/Resources/xlf/Strings.cs.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.de.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.es.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.fr.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.it.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.ja.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.ko.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.pl.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.ru.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.tr.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
| src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf | Adds localization entry for RunCommandRequiresWindowsForNetFramework. |
…ndows Adresses feedback from dotnet#51953 (comment)
akoeplinger
force-pushed
the
fix-netfx-run-on-unix
branch
from
July 3, 2026 10:32
26b19bb to
c962d14
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adresses feedback from #51953 (comment)