使用 brew 在 Macos 上运行多个版本的 .Net Core [英] Multiple versions of .Net Core on Macos with brew

查看:36
本文介绍了使用 brew 在 Macos 上运行多个版本的 .Net Core的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了一段时间,但我在 2019 年没有找到任何关于如何在 Mac 上从 .Net Core 获得多个版本的准确信息.我的用例是,我使用 .Net Core 2.2 进行主动开发,我想使用 .Net Core 3 以及它现在拥有的优点,例如 Razor Components 和 Blazor 的东西.

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.

我找到了关于 .Net Core 多个版本如何在 Windows 上的同一系统上运行的文章,这很棒.但是,Mac 不是 Windows(幸运的是,不幸的是),我想使用 brew 作为包管理器,它负责管理版本而不是我.如果可能的话,我不想搬出酿造区.

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.

我还没有找到关于 brew 如何帮助我的信息,而是抛出一条错误消息,说它将覆盖 dotnet 命令.

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]

我找到了关于 DNVM 的文章,但结果发现它是关于 .Net Core 1.x 的,从那时起似乎无法使用.

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

如何从 .Net Core 获得多个版本,例如使用 brew?如果 brew 不能这样做,那么建议的方法是什么?

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?

推荐答案

似乎 brew 帮不上忙,或者至少,我还没有找到解决方案.但是,只需从 .Net Core 网站下载和安装软件包即可解决问题.安装两个版本的 SDKS,您将同时拥有.

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

这篇关于使用 brew 在 Macos 上运行多个版本的 .Net Core的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆