Repository navigation
Conversation
Mirror the Unix dnx shim on Windows by shipping dnx.cmd from the sharedhost (dotnet-host) MSI so both install roots stay in sync. Co-authored-by: Copilot App <[email protected]> Copilot-Session: b17adf1a-bcda-445b-b5e7-0b5fe876851f
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a Windows dnx.cmd shim to the dotnet-host (sharedhost) installer/package output so dnx is installed/uninstalled alongside dotnet.exe in the shared host roots.
Changes:
- Add a new Windows batch shim (
dnx.cmd) that dispatches todotnet exec ... dnx. - Publish
dnx.cmdon non-Unix targets fromdotnet-host.proj(mirroring the existing Unixdnxpublish). - Install
dnx.cmdvia the sharedhost MSI and copy it intoPROGRAMFILES_DOTNETsimilarly todotnet.exe.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/installer/pkg/sfx/installers/host.wxs | Adds an MSI component to install/copy dnx.cmd into both DOTNETHOME and Program Files roots. |
| src/installer/pkg/sfx/installers/dotnet-host.proj | Publishes dnx.cmd on Windows (non-Unix) builds alongside the existing Unix dnx publish behavior. |
| src/installer/pkg/sfx/installers/dnx.cmd | Introduces the Windows dnx shim batch script. |
Comment on lines
+21
to
+23
| "%DOTNET%" exec "%SDK_PATH%" dnx %* | ||
|
|
||
| endlocal |
A trailing bare `endlocal` resets ERRORLEVEL to 0, so callers saw success even when `dotnet exec ... dnx` failed. Use `endlocal & exit /b %ERRORLEVEL%` so the child process exit code is returned to the caller. Co-authored-by: Copilot App <[email protected]> Copilot-Session: b17adf1a-bcda-445b-b5e7-0b5fe876851f
Comment on lines
+7
to
+21
| set "DOTNET=%~dp0dotnet.exe" | ||
|
|
||
| set "SDK_VERSION=" | ||
| for /f "tokens=1" %%i in ('"%DOTNET%" --list-sdks') do ( | ||
| set "SDK_VERSION=%%i" | ||
| ) | ||
|
|
||
| if not defined SDK_VERSION ( | ||
| echo Error: dnx requires a .NET SDK to be installed, but none was found. 1>&2 | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| set "SDK_PATH=%~dp0sdk\%SDK_VERSION%\dotnet.dll" | ||
|
|
||
| "%DOTNET%" exec "%SDK_PATH%" dnx %* |
mthalman
added a commit
to mthalman/sdk
that referenced
this pull request
Jul 14, 2026
The Windows zip-layout dnx.cmd ended with a bare endlocal, which resets ERRORLEVEL to 0 and swallowed the exit code from 'dotnet exec ... dnx'. Callers would see success even when dnx failed. Mirror the sharedhost dnx.cmd fix (dotnet/runtime#130686) by exiting with the propagated code. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd879cfe-e142-4eea-9d76-c5eb4467195f
This was referenced Jul 14, 2026
mthalman
added a commit
to dotnet/dotnet
that referenced
this pull request
Jul 21, 2026
Windows follow-up to the dnx double-ship fix (dotnet/sdk#55241 for macOS). On Windows the SDK 'dev' MSI and the runtime sharedhost MSI both wrote dnx.cmd to the same install root, creating overlapping component packages (silent last-writer-wins / ref-count uninstall risk). Move dnx.cmd ownership to the sharedhost package and stop the SDK component from installing it. SDK (src/sdk): - GenerateInstallerLayout.targets: skip the dnx copy into the dev-MSI intermediate layout on Windows too (already skipped on macOS). LayoutDnxShim still emits dnx.cmd into the base redist layout (zip/tarball). - redist/dnx.cmd: end with 'endlocal & exit /b %ERRORLEVEL%' so the shim propagates dnx's exit code instead of swallowing it. Runtime (src/runtime): - New installers/dnx.cmd: Windows shim mirroring the Unix dnx shim, with a missing-SDK guard and exit-code propagation. - dotnet-host.proj: publish dnx.cmd to the sharedhost output on Windows. - host.wxs: add cmpDnxCmd component installing dnx.cmd to DOTNETHOME with a CopyFile to PROGRAMFILES_DOTNET, mirroring cmpCoreHost. Mirrors dotnet/sdk#55268 and dotnet/runtime#130686. Co-authored-by: Copilot App <[email protected]> Copilot-Session: cd879cfe-e142-4eea-9d76-c5eb4467195f
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Why
Today on Windows, the
dnxlauncher is shipped only by the SDKdevMSI; the sharedhost MSI does not ship it. That leavesdnxowned by a different installer thandotnet.exe, so the two can target different roots and drift out of sync (see dotnet/sdk#55116).This moves ownership of the Windows
dnxlauncher to the sharedhost MSI, sodnxships and uninstalls alongsidedotnet.exein every root the host is installed to. It is the Windows follow-up to the Unixdnxshim added in #129258.What
src/installer/pkg/sfx/installers/dnx.cmd, a Windows batch mirror of the existing Unixdnxshim: it resolvesdotnet.exenext to itself, picks the newest installed SDK fromdotnet --list-sdks, and dispatchesdotnet exec sdk\<version>\dotnet.dll dnx %*. It ends withendlocal & exit /b %ERRORLEVEL%so it propagatesdnx's exit code.dotnet-host.proj: publishesdnx.cmdon Windows only (TargetsUnix != 'true'), as a sibling to the existing Unixdnxentry. Nochmodis applied (that remains Unix-only).host.wxs: adds a newcmpDnxCmdcomponent that installsdnx.cmdintoDOTNETHOMEandCopyFiles it toPROGRAMFILES_DOTNET, mirroring howcmpCoreHosthandlesdotnet.exesodnxlands in both roots.Notes for reviewers
devMSI from shippingdnx.cmdon Windows. The two changes must land together: adding it here without the SDK removal would givednx.cmdtwo owners (a silent cross-MSI overlap, since Windows MSI does not hard-fail on it), while merging the SDK removal without this change would leave Windows with nodnxat all.dnx.cmd, this version adds a missing-SDK guard (if not defined SDK_VERSION ... exit /b 1). That matches the Unix shim's behavior and is the correct choice for the host package, which can be installed without any SDK present.Note
This pull request was authored with the assistance of GitHub Copilot.