Skip to content

Use dotnet dnx to acquire the Aspire CLI when the dnx shim isn't on PATH #22442

Open

Description

@afscrome

Describe the bug

On Linux x64 CI, an Aspire 17.0.0 AppHost configured with AspireCliInvocationMode=DnxPinned fails to build on a clean agent when dotnet is on PATH but the standalone dnx shim is not. The SDK selects DNX mode but never starts DNX to acquire the pinned CLI or prepare the bundle.

Diagnostics

The build reports ASPIRE009 (the Aspire CLI bundle could not be resolved) and suggests installing the Aspire CLI or setting an explicit CLI or bundle path. It doesn't say that it couldn't find dnx. In the diagnostic binlog, the only clue we found was an empty dnx: field:

Aspire CLI invocation selection: Dnx (aspire: , dnx: )

That makes it hard to distinguish a missing launcher from an aspire.cli restore failure. ASPIRE011 describes the missing command clearly, but is emitted during run preflight, not during the build that failed here. If no usable DNX launcher can be resolved during bundle acquisition, please include that fact in the build error and binlog.

Steps to reproduce

  1. On a clean Linux x64 agent, extract the SDK archives into /usr/share/dotnet and symlink only dotnet into a directory on PATH. This is equivalent to our CI image setup:

    for channel in 10.0 11.0; do
      version=$(wget -qO- "https://builds.dotnet.microsoft.com/dotnet/Sdk/$channel/latest.version")
      archive="dotnet-sdk-$version-linux-x64.tar.gz"
      wget -q "https://builds.dotnet.microsoft.com/dotnet/Sdk/$version/$archive"
      tar -C /usr/share/dotnet -xzf "$archive"
      rm "$archive"
    done
    ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
    echo 'DOTNET_ROOT=/usr/share/dotnet' >> /etc/environment

    Leave /usr/share/dotnet off PATH and don't symlink dnx. command -v dotnet should succeed and command -v dnx should not. The shim may be present in the SDK installation; the issue is that it's not on PATH.

  2. With no existing Aspire CLI bundle, set <AspireCliInvocationMode>DnxPinned</AspireCliInvocationMode> on an Aspire 17.0.0 AppHost and run dotnet build -bl. The failing CI run selected SDK 10.0.404 and targeted net10.0.

Expected behavior

When the selected .NET SDK supports DNX, Aspire should be able to acquire the pinned CLI through the dotnet host without requiring the standalone shim on PATH. For example, fall back to dotnet dnx --yes aspire.cli@17.0.0 -- setup … when the shim can't be resolved. This would preserve the shim's existing SDK-selection behavior when it is available.

Workaround

Our Linux CI build passed after selecting the .NET 11 SDK and adding the following to Directory.Build.targets; the AppHost still targets net10.0. This uses internal Aspire targets and properties, so it is a workaround, not a supported extension point.

<Project>
  <!-- Aspire's resolver discovers the dnx shim; fall back to the SDK host when only dotnet is exposed. -->
  <Target Name="UseDotnetDnxWhenDnxShimIsUnavailable"
          AfterTargets="_ResolveAspireCliInvocation"
          Condition="'$(IsAspireHost)' == 'true'
                     and '$(AspireUseCliBundle)' == 'true'
                     and '$(AspireCliPath)' == ''
                     and '$(_AspireResolvedCliInvocationMode)' == 'Dnx'
                     and '$(_AspireResolvedDnxPath)' == ''
                     and '$(DOTNET_HOST_PATH)' != ''
                     and Exists('$(DOTNET_HOST_PATH)')">
    <PropertyGroup>
      <_AspireResolvedDnxPath>$(DOTNET_HOST_PATH)</_AspireResolvedDnxPath>
      <_AspireResolvedDnxHostPath>$(DOTNET_HOST_PATH)</_AspireResolvedDnxHostPath>
      <_AspireResolvedDnxHostArguments>dnx</_AspireResolvedDnxHostArguments>
      <_AspireResolvedDnxHostArgumentsPrefix>dnx </_AspireResolvedDnxHostArgumentsPrefix>
    </PropertyGroup>
    <ItemGroup>
      <_AspireResolvedDnxHostArgument Remove="@(_AspireResolvedDnxHostArgument)" />
      <_AspireResolvedDnxHostArgument Include="dnx" />
    </ItemGroup>
    <Message Text="The dnx shim was not found on PATH; using '$(DOTNET_HOST_PATH) dnx' instead." Importance="Low" />
  </Target>
</Project>

Activity

  1. joperezr commented on Nov 19, 2026

    @joperezr
    Member
    🤖 Aspire triage pass — 2026-11-19 21:35 UTC

    Area: area-cli
    Kind: bug
    Repro: yes-minimal — see lines 17–32 of the issue body; reported steps, not independently executed
    Affected version(s): 17.0.0 (last working: not established; latest: 17.0.0); SDK version reported in line 32
    Severity: S3 — clean Linux CI builds fail with a restricted launcher search path; a workaround is reported in lines 40–67, with additional SDK requirements

    Urgency: ⚪ backlog — no milestone
    Reason: no confirmed regression baseline or evidence of broad impact; the configured release context is stale, and expected milestone 13.6 is not open. No substitute milestone was selected.

    Suggested owner(s): David Fowler (@davidfowl) (score 222; provisional, availability not verified)
    Evidence:

    Confidence: medium
    Needs human?: yes — expected milestone 13.6 is not open; release-train configuration and suggested owner's availability require confirmation

  2. added
    triage:bot-seen
    triage:needs-human
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-clitriage:bot-seentriage:needs-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions