- Microsoft Netcore App
- Microsoft Netcore Runtime Download
- Microsoft Netcore App 2.2
- Microsoft Netcore App Mac Pro
- Microsoft Netcore App Mac Desktop
- Netcore App 3.1
I'm trying to run an ASP.NET Core 2.0 app on a Mac, but it doesn't build for the following reason: Package Microsoft.AspNetCore.All 2.1.5 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). 项目使用的 Nuget 包,比如 Microsoft.AspNetCore.App等的版本号要与.NET Core 版本号(不是SDK版本号,后续说明)保持一致,否则编译或者运行. App Center requires JavaScript. JavaScript is not enabled in your browser. Please enable JavaScript and refresh this page. The runtime is used to run apps created with.NET Core. When an app author publishes an app, they can include the runtime with their app. If they don't include the runtime, it's up to the user to install the runtime. There are three different runtimes you can install on macOS: ASP.NET Core runtime. In Visual Studio for Mac earlier than version 8.6, select.NET Core App Web Application (Model-View-Controller) Next. In version 8.6 or later, select Web and Console App Web Application (Model-View-Controller) Next. In the Configure your new Web Application dialog: Confirm that Authentication is set to No Authentication.
In this article, you'll learn how to install .NET on macOS. .NET is made up of the runtime and the SDK. The runtime is used to run a .NET app and may or may not be included with the app. The SDK is used to create .NET apps and libraries. The .NET runtime is always installed with the SDK.
The latest version of .NET is 5.0.
Supported releases
The following table is a list of currently supported .NET releases and the versions of macOS they're supported on. These versions remain supported either the version of .NET reaches end-of-support.
- A ✔️ indicates that the version of .NET Core is still supported.
- A ❌ indicates that the version of .NET Core isn't supported.
Operating System | .NET Core 2.1 | .NET Core 3.1 | .NET 5.0 |
---|---|---|---|
macOS 10.15 'Catalina' | ✔️ 2.1 (Release notes) | ✔️ 3.1 (Release notes) | ✔️ 5.0 (Release notes) |
macOS 10.14 'Mojave' | ✔️ 2.1 (Release notes) | ✔️ 3.1 (Release notes) | ✔️ 5.0 (Release notes) |
macOS 10.13 'High Sierra' | ✔️ 2.1 (Release notes) | ✔️ 3.1 (Release notes) | ✔️ 5.0 (Release notes) |
macOS 10.12 'Sierra' | ✔️ 2.1 (Release notes) | ❌ 3.1 (Release notes) | ❌ 5.0 (Release notes) |
Unsupported releases
The following versions of .NET are ❌ no longer supported. The downloads for these still remain published:
- 3.0 (Release notes)
- 2.2 (Release notes)
- 2.0 (Release notes)
Runtime information
The runtime is used to run apps created with .NET. When an app author publishes an app, they can include the runtime with their app. If they don't include the runtime, it's up to the user to install the runtime.
There are three different runtimes you can install on macOS:
ASP.NET Core runtime
Runs ASP.NET Core apps. Includes the .NET runtime.
Runs ASP.NET Core apps. Includes the .NET runtime.
.NET runtime
This runtime is the simplest runtime and doesn't include any other runtime. It's highly recommended that you install ASP.NET Core runtime for the best compatibility with .NET apps.
This runtime is the simplest runtime and doesn't include any other runtime. It's highly recommended that you install ASP.NET Core runtime for the best compatibility with .NET apps.
SDK information
The SDK is used to build and publish .NET apps and libraries. Installing the SDK includes both runtimes: ASP.NET Core and .NET.
Dependencies
.NET is supported on the following macOS releases:
.NET Core Version | macOS | Architectures | More information |
---|---|---|---|
5.0 | High Sierra (10.13+) | x64 | More information |
3.1 | High Sierra (10.13+) | x64 | More information |
3.0 | High Sierra (10.13+) | x64 | More information |
2.2 | Sierra (10.12+) | x64 | More information |
2.1 | Sierra (10.12+) | x64 | More information |
Beginning with macOS Catalina (version 10.15), all software built after June 1, 2019 that is distributed with Developer ID, must be notarized. This requirement applies to the .NET runtime, .NET SDK, and software created with .NET.
The runtime and SDK installers for .NET 5.0 and .NET Core 3.1, 3.0, and 2.1, have been notarized since February 18, 2020. Prior released versions aren't notarized. If you run a non-notarized app, you'll see an error similar to the following image:
For more information about how enforced-notarization affects .NET (and your .NET apps), see Working with macOS Catalina Notarization.
libgdiplus
.NET applications that use the System.Drawing.Common assembly require libgdiplus to be installed.
An easy way to obtain libgdiplus is by using the Homebrew ('brew') package manager for macOS. After installing brew, install libgdiplus by executing the following commands at a Terminal (command) prompt:
Install with an installer
macOS has standalone installers that can be used to install the .NET 5.0 SDK:
Download and manually install
As an alternative to the macOS installers for .NET, you can download and manually install the SDK and runtime. Manual install is usually performed as part of continuous integration testing. For a developer or user, it's generally better to use an installer.
![Netcore app 2.2 Netcore app 2.2](/uploads/1/3/4/1/134144020/395451452.jpg)
If you install .NET SDK, you don't need to install the corresponding runtime. First, download a binary release for either the SDK or the runtime from one of the following sites:
- ✔️ .NET 5.0 downloads
- ✔️ .NET Core 3.1 downloads
- ✔️ .NET Core 2.1 downloads
Next, extract the downloaded file and use the
export
command to set variables used by .NET and then ensure .NET is in PATH.To extract the runtime and make the .NET CLI commands available at the terminal, first download a .NET binary release. Then, open a terminal and run the following commands from the directory where the file was saved. The archive file name may be different depending on what you downloaded.
Use the following command to extract the runtime:
![Netcore Netcore](/uploads/1/3/4/1/134144020/459010791.png)
Use the following command to extract the SDK:
Tip
The preceding
export
commands only make the .NET CLI commands available for the terminal session in which it was run.You can edit your shell profile to permanently add the commands. There are a number of different shells available for Linux and each has a different profile. For example:
- Bash Shell: ~/.bash_profile, ~/.bashrc
- Korn Shell: ~/.kshrc or .profile
- Z Shell: ~/.zshrc or .zprofile
Edit the appropriate source file for your shell and add
:$HOME/dotnet
to the end of the existing PATH
statement. If no PATH
statement is included, add a new line with export PATH=$PATH:$HOME/dotnet
.Also, add
export DOTNET_ROOT=$HOME/dotnet
to the end of the file.This approach lets you install different versions into separate locations and choose explicitly which one to use by which application.
Install with Visual Studio for Mac
Visual Studio for Mac installs the .NET SDK when the .NET workload is selected. To get started with .NET development on macOS, see Install Visual Studio 2019 for Mac.
.NET SDK version | Visual Studio version |
---|---|
5.0 | Visual Studio 2019 for Mac version 8.8 or higher. |
3.1 | Visual Studio 2019 for Mac version 8.4 or higher. |
2.1 | Visual Studio 2019 for Mac version 8.0 or higher. |
Microsoft Netcore App
Install alongside Visual Studio Code
Visual Studio Code is a powerful and lightweight source code editor that runs on your desktop. Visual Studio Code is available for Windows, macOS, and Linux.
While Visual Studio Code doesn't come with an automated .NET installer like Visual Studio does, adding .NET support is simple.
- Download and install Visual Studio Code.
- Download and install the .NET SDK.
- Install the C# extension from the Visual Studio Code marketplace.
Install with bash automation
Microsoft Netcore Runtime Download
The dotnet-install scripts are used for automation and non-admin installs of the runtime. You can download the script from the dotnet-install script reference page.
The script defaults to installing the latest long term support (LTS) version, which is .NET 5.0. You can choose a specific release by specifying the
current
switch. Include the runtime
switch to install a runtime. Otherwise, the script installs the SDK.Note
The previous command installs the ASP.NET Core runtime for maximum compatability. The ASP.NET Core runtime also includes the standard .NET runtime.
Docker
Containers provide a lightweight way to isolate your application from the rest of the host system. Containers on the same machine share just the kernel and use resources given to your application.
.NET can run in a Docker container. Official .NET Docker images are published to the Microsoft Container Registry (MCR) and are discoverable at the Microsoft .NET Core Docker Hub repository. Each repository contains images for different combinations of the .NET (SDK or Runtime) and OS that you can use.
Microsoft provides images that are tailored for specific scenarios. For example, the ASP.NET Core repository provides images that are built for running ASP.NET Core apps in production.
For more information about using .NET Core in a Docker container, see Introduction to .NET and Docker and Samples.
Next steps
- How to check if .NET Core is already installed.
- Working with macOS Catalina notarization.
- Tutorial: Get started on macOS.
- Tutorial: Create a new app with Visual Studio Code.
- Tutorial: Containerize a .NET Core app.
本文介绍如何检查计算机上安装的 .NET Core 运行时和 SDK 的版本。This article teaches you how to check which versions of the .NET Core runtime and SDK are installed on your computer.如果你拥有一个集成开发环境(如 Visual Studio 或 Visual Studio for Mac),则可能已安装 .NET core。.NET core may have already been installed if you have an integrated development environment, such as Visual Studio or Visual Studio for Mac.
安装 SDK 便会安装相应的运行时。Installing an SDK installs the corresponding runtime.
如果本文中的任何命令失败,则未安装运行时或 SDK。If any command in this article fails, you don't have the runtime or SDK installed.有关详细信息,请参阅 Windows、macOS 或 Linux 的安装文章。For more information, see the install articles for Windows, macOS, or Linux.
检查 SDK 版本Check SDK versions
可使用终端查看当前安装的 .NET Core SDK 版本。You can see which versions of the .NET Core SDK are currently installed with a terminal.打开终端并运行以下命令。Open a terminal and run the following command.
Microsoft Netcore App 2.2
将获得类似于下面的输出。You get output similar to the following.
检查运行时版本Check runtime versions
可使用以下命令查看当前安装的 .NET Core 运行时版本。You can see which versions of the .NET Core runtime are currently installed with the following command.
将获得类似于下面的输出。You get output similar to the following.
检查安装文件夹Check for install folders
可以安装 .NET Core,但不能将其添加到操作系统或用户配置文件的
PATH
变量。It's possible that .NET Core is installed but not added to the PATH
variable for your operating system or user profile.运行前面几节中的命令可能不起作用。Running the commands from the previous sections may not work.作为替代方法,可以检查 .NET Core 安装文件夹是否存在。As an alternative, you can check that the .NET Core install folders exist.从安装程序或脚本安装 .NET Core 时,会将其安装到标准文件夹中。When you install .NET Core from an installer or script, it's installed to a standard folder.大多数时候,安装 .NET Core 时使用的安装程序或脚本会让你选择安装到另一个文件夹。Much of the time the installer or script you're using to install .NET Core gives you an option to install to a different folder.如果选择安装到其他文件夹,请调整文件夹路径的开头。If you choose to install to a different folder, adjust the start of the folder path.
- dotnet executabledotnet executable
C:program filesdotnetdotnet.exeC:program filesdotnetdotnet.exe - .NET SDK.NET SDK
C:program filesdotnetsdk{version}C:program filesdotnetsdk{version} - .NET Runtime.NET Runtime
C:program filesdotnetshared{runtime-type}{version}C:program filesdotnetshared{runtime-type}{version}
- dotnet executabledotnet executable
/home/user/share/dotnet/dotnet/home/user/share/dotnet/dotnet - .NET SDK.NET SDK
/home/user/share/dotnet/sdk/{version}//home/user/share/dotnet/sdk/{version}/ - .NET Runtime.NET Runtime
/home/user/share/dotnet/shared/{runtime-type}/{version}//home/user/share/dotnet/shared/{runtime-type}/{version}/
Microsoft Netcore App Mac Pro
- dotnet executabledotnet executable
/usr/local/share/dotnet/dotnet/usr/local/share/dotnet/dotnet - .NET SDK.NET SDK
/usr/local/share/dotnet/sdk/{version}//usr/local/share/dotnet/sdk/{version}/ - .NET Runtime.NET Runtime
/usr/local/share/dotnet/shared/{runtime-type}/{version}//usr/local/share/dotnet/shared/{runtime-type}/{version}/
详细信息More information
Microsoft Netcore App Mac Desktop
可通过命令
dotnet --info
查看 SDK 版本和运行时版本。You can see both the SDK versions and runtime versions with the command dotnet --info
.你还将获得其他环境相关信息,如操作系统版本和运行时标识符 (RID)。You'll also get other environmental related information, such as the operating system version and runtime identifier (RID).后续步骤Next steps
Netcore App 3.1
- 安装 .NET Core 运行时和 SDK。Install the .NET Core Runtime and SDK.