Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
analogrelay opened this issue Nov 2, 2018 · 6 comments
Assignees

Comments

@analogrelay
Copy link
Contributor

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.

@alexperovich
Copy link
Member

That code is a bit odd. Why is it not just (Get-Command dotnet.exe).Path on windows and command -v dotnet on linux?

@markwilkie
Copy link
Member

@anurse - thoughts on @alexperovich comment?

@analogrelay
Copy link
Contributor Author

Sounds fine to me. I just want the script to find dotnet even when I have multiple on the PATH :)

@markwilkie
Copy link
Member

The solution to #1253 likely makes this better.

analogrelay added a commit to aspnet/AspLabs that referenced this issue Nov 26, 2018
@analogrelay
Copy link
Contributor Author

Ping @chcosta @natemcmaster

@tmat
Copy link
Member

tmat commented Nov 30, 2018

I'll have a fix soon.

@tmat tmat self-assigned this Nov 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants