Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple versions of .Net Core on Macos with brew

I have been searching for a while but I haven't found anything accurate in 2019 about that how can I have multiple versions from .Net Core on Mac. My use case is that, I use .Net Core 2.2 for active development, and I'd like to play with .Net Core 3 and the goodness it has now like Razor Components and Blazor stuff.

I found articles about how .Net Core multiple version can live on the same system on Windows, which is awesome. But, Mac is not Windows (luckily, and unfortunately), and I'd like to use brew as package manager which is dealing with managing versions instead of me. If it is possible, I don't want to move out form brew zone.

I haven't found information about that how brew can help me out, rather it throws an error message saying that it will overwrite dotnet command.

mbp2017 ➜  ~ brew search dotnet ==> Casks dotnet                                      dotnet-preview                              dotnet-sdk ✔                                dotnet-sdk-preview mbp2017 ➜  ~ dotnet --info .NET Core SDK (reflecting any global.json):  Version:   2.2.105  Commit:    7cecb35b92  Runtime Environment:  OS Name:     Mac OS X  OS Version:  10.14  OS Platform: Darwin  RID:         osx.10.14-x64  Base Path:   /usr/local/share/dotnet/sdk/2.2.105/  Host (useful for support):   Version: 2.2.3   Commit:  6b8ad509b6  .NET Core SDKs installed:   2.2.105 [/usr/local/share/dotnet/sdk]  .NET Core runtimes installed:   Microsoft.AspNetCore.All 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]   Microsoft.AspNetCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]   Microsoft.NETCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]  To install additional .NET Core runtimes or SDKs:   https://aka.ms/dotnet-download mbp2017 ➜  ~ brew cask install dotnet-sdk-preview Error: Cask 'dotnet-sdk-preview' conflicts with 'dotnet-sdk'. ➜  ~ dotnet --list-sdks 2.2.105 [/usr/local/share/dotnet/sdk] 

I found articles about DNVM, but turned out that it was something around .Net Core 1.x, since then seems not usable.

How is possible to have multiple versions from .Net Core for example using brew? If brew can't do this, then what is the suggested way?

like image 359
AndrasCsanyi Avatar asked Mar 27 '19 22:03

AndrasCsanyi


People also ask

Can you have multiple versions of .NET Core?

You may have multiple versions of . NET Core installed on same box and some applications may need some specific version of . NET Core. This is why installers doesn't remove previous versions.

Can you run .NET Core on Mac?

NET Core is that you can run it on multiple platforms and architectures. So you can build an app that will run on Windows, but also on Linux, macOS and on different architectures like x86 and ARM.

Can I install both .NET Core and .NET framework?

NET Core installations are completely independent from the version of . NET Framework. In fact, you can actually install multiple version of . NET Core side-by-side on the same machine (unlike .

How to install multiple node versions on MacOS X?

Here is a quick tip on how to install multiple Node.js versions (10, 12, 13 etc.) on macOS X and how to switch between them for your applications. Install multiple Node versions using Homebrew. To install Homebrew run: Now install the Node versions you need using brew: To check the default node version and installation path:

How to install multiple node versions using Homebrew?

Install multiple Node versions using Homebrew. To install Homebrew run: Now install the Node versions you need using brew: To check the default node version and installation path:

Does homebrew/core support multiple versioned formulae?

homebrew/core supports multiple versions of formulae with a special naming format. For example, the formula for GCC 6 is named [email protected] and begins with class GccAT6 < Formula. Versioned formulae we include in homebrew/core must meet the following standards:

Where is the DotNet 6 SDK installed on a Mac?

On an Arm-based Mac, all Arm64 versions of .NET are installed to the normal /usr/local/share/dotnet/ folder. However, when you install the x64 version of .NET 6 SDK, it's installed to the /usr/local/share/dotnet/x64/dotnet/ folder. The x64 .NET 6 SDK installs to its own directory, as described in the previous section.


2 Answers

A little late to the party but you can now do this with the dotnet-sdk-versions tap.

You can find it here: https://github.com/isen-ng/homebrew-dotnet-sdk-versions

brew tap isen-ng/dotnet-sdk-versions brew install --cask dotnet-sdk2-2-100  dotnet --list-sdks 

Disclaimer: I wrote the tap 2 days ago

like image 68
Isen Ng Avatar answered Sep 19 '22 12:09

Isen Ng


It seems brew cannot help, or at least, I haven't find a solution. However, just downloading and installing packages from .Net Core websites solves the problem. Installing both version SDKS, you will have both.

➜  ~ dotnet --info .NET Core SDK (reflecting any global.json):  Version:   3.0.100-preview3-010431  Commit:    d72abce213  Runtime Environment:  OS Name:     Mac OS X  OS Version:  10.14  OS Platform: Darwin  RID:         osx.10.14-x64  Base Path:   /usr/local/share/dotnet/sdk/3.0.100-preview3-010431/  Host (useful for support):   Version: 3.0.0-preview3-27503-5   Commit:  3844df9537  .NET Core SDKs installed:   2.2.105 [/usr/local/share/dotnet/sdk]   3.0.100-preview3-010431 [/usr/local/share/dotnet/sdk]  .NET Core runtimes installed:   Microsoft.AspNetCore.All 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]   Microsoft.AspNetCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]   Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]   Microsoft.NETCore.App 2.2.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]   Microsoft.NETCore.App 3.0.0-preview3-27503-5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]  To install additional .NET Core runtimes or SDKs:   https://aka.ms/dotnet-download 
like image 43
AndrasCsanyi Avatar answered Sep 20 '22 12:09

AndrasCsanyi