Skip to content

DOTNET_INSTALL_DIR is corrupted if there are multiple dotnet CLI installs on the path #1251

@analogrelay

Description

@analogrelay

If the user has multiple dotnet CLIs on their path, the DOTNET_INSTALL_DIR value gets corrupted because this code doesn't properly select the first result:

https://github.com/dotnet/arcade-minimalci-sample/blob/a249ce8e79a9b71d5367d7bc59132121a7490d5b/eng/common/tools.ps1#L36-L38

On my machine, where the PATH search yields multiple results, DOTNET_INSTALL_DIR ends up being set to multiple directories:

Incorrect DOTNET_INSTALL_DIR value

This causes the search for the correct SDK version to fail, and Arcade changes to use a repo-local .dotnet directory, which is definitely not what I wanted :).

A simple patch to add | select -first 1 on the end fixes this for PowerShell. Haven't checked if this occurs in Bash as well.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions