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

GitVersion should rely on existing dotnet SDKs rather than downloading it using brew #2551

Closed
iamNoah1 opened this issue Jan 18, 2021 · 7 comments · Fixed by #2599
Closed
Assignees
Milestone

Comments

@iamNoah1
Copy link

iamNoah1 commented Jan 18, 2021

I recognized that when I install GitVersion using brew on macos, it downloads a separate dotnet SDK using brew as well. Instead, it should rely on the existing one.

Detailed Description

I faced a problem that after installing GitVersion using brew, my Visual Studio Code Omnisharp could not find the installed SDKs anymore.

After doing some research, I deleted dotnet using brew and reinstalled dotnet using the official installer. After that my Visuals Studio Code Omnisharp found the SDK again, but my GitVersion was not working anymore.

I assume that installing GitVersion using brew, not only installs dotnet via brew, but also changes Environment that is responsible for pointing to a specific dotnet SDK version when invoking the dotnet command. Probable it changes the PATH in a way that the dotnet version installed via brew gets found first, before the one installed via the official installer.

Context

The importance of this is the following. With the described scenario I had to choose if I want to have GitVersion working or my Visual Studio Code Omnisharp. Both were not working at the same time. I had to create a symlink in order to tell GitVersion to use the SDK installed via the official installer.

sudo mkdir -p /usr/local/opt/dotnet/bin
sudo ln -s /usr/local/share/dotnet/dotnet /usr/local/opt/dotnet/bin/dotnet

Possible Implementation

  • Installing dotnet as well could be made optional using a flag
  • The SDK could be specified using an Env variable
  • GitVersion could first check if there is any dotnet SDK already installed before wanting to install a fresh one
@arturcic
Copy link
Member

@asbjornu can you check that?

@asbjornu
Copy link
Member

Homebrew can't set environment variables globally on your machine on install and installs formulae to a different path than the official installer so you would need to adjust the DOTNET_ROOT and PATH to the path Homebrew installs to. This should probably be noted in the Homebrew formula (see Homebrew/discussions#568).

In the meantime, I would advise you to uninstall Microsoft's official SDK, install Homebrew's dotnet formula, and add the following to your ~/.bash_profile or ~/.zshrc file (and remember to source the file to update your current session):

export PATH="$(brew --prefix)/bin:$PATH"
export DOTNET_ROOT="/usr/local/Cellar/dotnet/3.1.108/libexec"

@iamNoah1
Copy link
Author

I see, thanks for the info :)

@asbjornu
Copy link
Member

Homebrew/homebrew-core#69323 seeks to add this information to the dotnet formula. Please close the issue if you got it working, @iamNoah1.

@asbjornu asbjornu mentioned this issue Feb 22, 2021
5 tasks
@asbjornu asbjornu added this to the 5.6.7 milestone Feb 22, 2021
@arturcic
Copy link
Member

🎉 This issue has been resolved in version 5.6.7 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

@jnyrup
Copy link

jnyrup commented Apr 11, 2021

@arturcic You might be interested in fixing the typo (botnet -> dotnet) the title of this issue and the related changelog.

@arturcic arturcic changed the title GitVersion should rely on existing botnet SDKs rather than downloading it using brew GitVersion should rely on existing dotnet SDKs rather than downloading it using brew Apr 11, 2021
@arturcic
Copy link
Member

Thanks for catching that. Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants