UFO ET IT

.NET Core에서 SDK와 런타임의 차이점은 무엇입니까?

ufoet 2020. 12. 8. 20:30
반응형

.NET Core에서 SDK와 런타임의 차이점은 무엇입니까?


기사를 포함하여 많은 기사를 읽었 지만 여전히 차이점이 무엇인지 파악할 수 없으며 단순한 용어로 또는 전혀 설명하지 않았습니다.

누군가 .NET SDK와 .NET Runtime의 차이점이 무엇인지 명확히 할 수 있습니까?

업데이트 : 비교를 사용하면 매우 감사하겠습니다. 간단한 영어와 함께 비유는 매우 교육적입니다.


.Net Core Guide 에 따르면 .NET Core는 다음 항목으로 구성됩니다.

  • 유형 시스템, 어셈블리 로딩, 가비지 수집기, 네이티브 interop 및 기타 기본 서비스를 제공하는 .NET 런타임.
  • 기본 데이터 유형, 앱 구성 유형 및 기본 유틸리티를 제공하는 프레임 워크 라이브러리 세트입니다.
  • .NET Core SDK에서 사용할 수있는 기본 개발자 환경을 지원하는 SDK 도구 및 언어 컴파일러 집합입니다.
  • .NET Core 앱을 시작하는 데 사용되는 'dotnet'앱 호스트입니다. 런타임을 선택하고 런타임을 호스팅하고 어셈블리로드 정책을 제공하고 앱을 시작합니다. 동일한 호스트를 사용하여 거의 동일한 방식으로 SDK 도구를 시작합니다.

SDK는 CLI 및 컴파일러와 같이 .NET Core 애플리케이션을 더 쉽게 개발하는 데 필요한 모든 요소입니다.

런타임은 애플리케이션을 호스팅 / 실행하고 기본 운영 체제와의 모든 상호 작용을 추상화하는 "가상 머신"입니다.

응용 프로그램을 실행하려면 후자 만 필요하지만 응용 프로그램을 개발하려면 전자가 필요합니다.


나는 여기서 아무것도 발명하지 않습니다. https://www.microsoft.com/net/download 에서 정의를 복사하여 붙여 넣기 만하면됩니다.

여기에 이미지 설명 입력

소프트웨어 개발 키트 ( SDK )에는 명령 줄 도구 및 모든 편집기 (Visual Studio 포함)를 사용하여 .NET Core 애플리케이션을 빌드하고 실행하는 데 필요한 모든 것이 포함되어 있습니다.

런타임은 기존의 .NET 핵심 응용 프로그램을 실행하는 데 필요한 단지 자원이 포함되어 있습니다. 런타임은 SDK에 포함되어 있습니다.


런타임 : 앱 실행

SDK (Runtime + Tooling) : 앱 빌드 및 실행


Rick Strahl의 게시물 공유 : 어떤 .NET Core 런타임 다운로드가 필요합니까?

.NET Core 런타임 만 애플리케이션을 실행하는 데 필요하며 설치에 대한 정보를 제공합니다.

애플리케이션을 개발, 빌드 및 게시하려면 SDK가 필요합니다.

dotnet.exe런타임 설치로 설치되지만 애플리케이션 실행 에 대한 정보를 제공하고 설치에 대한 정보를 제공 하는 핵심 기능 만 제공합니다 . . 빌드, 게시 또는 기타 작업을 수행하려면 SDK를 설치해야합니다.dotnet mydll.dlldotnet --info

다음 명령을 실행하면 설치에 대한 정보가 제공됩니다.

dotnet --info

명령이 실패하면 .NET Core 런타임이 설치되어 있지 않거나 시스템의 PATH에서 사용할 수 없음을 의미합니다.

다음은 명령의 샘플 출력입니다.

$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.2.101
 Commit:    236713b0b7

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.2.101/

Host (useful for support):
  Version: 2.2.0
  Commit:  1249f08fed

.NET Core SDKs installed:
  2.1.4 [/usr/local/share/dotnet/sdk]
  2.1.302 [/usr/local/share/dotnet/sdk]
  2.2.101 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

출력은 다음을 알려줍니다.

  • 설치된 SDK 버전
  • 이 dotnet 명령을 실행하는 활성 런타임 버전
  • 설치된 모든 런타임 및 SDK 목록

SDK를 설치하면 런타임도 설치됩니다.


macOS Homebrew 전용

Installing the homebrew-cask dotnet will conflict with the dotnet-sdk, so to get both the runtime, and the sdk install dotnet-sdk

brew cask install dotnet-sdk

In short, the runtime will allow your OS to run compiled C-Sharp, C# programs, and the sdk will allow you to compile programs written in C-Sharp, C#.


It's important to understand that you can have multiple runtimes and multiple SDKs installed and each project can use a different one. The runtime is determined by your project's runtime specifier in the .csproj file:

<TargetFramework>netcoreapp2.1</TargetFramework>

The SDK is either the last globally installed SDK which is the default, or you can explicitly override the SDK in a global.json placed in the solution root folder. The following explicitly forces my project to use the last RC SDK, instead of the RTM version:

{
 "sdk": {
   "version": "2.1.300-rc.31211"
 }
}

Generally, there should be no need to use a specific lower SDK version as the SDK is backwards compatible and can compile various versions of .NET Core applicatino back to v1.0. IOW, it's OK to use the latest SDK in almost all cases.

.NET Core Runtimes

The .NET Core Runtimes are the smallest self-contained and specific component and contain the absolute minimum to run just .NET Core on a specific platform.

Note it a runtime install does not include the ASP.NET Core meta package runtime dependencies, so if your application references Microsoft.AspNetCore.App or Microsoft.AspNetCore.All you have to seperately download the ASP.NET Core package. However, if you explicitly reference all ASP.NET Core Nuget packages rather than using the meta packages, those packages are deployed as part of your application and it can run with just the runtime.

Essentially you are trading installation package size vs. a runtime pre-install requirement.

References:


여기에 이미지 설명 입력

As summary: If you install SDK, you will have everything you need for development and running the app.


The SDK is all of the stuff that is needed/makes developing a .NET Core application easier, such as the CLI and a compiler.

The runtime is the "virtual machine" that hosts/runs the application and abstracts all the interaction with the base operating system.


The SDK usually includes documentation and other help files. The runtime contains only the binary files for the installation.


adding to stormwild's answer in case you have only the .Net Core Runtime installed you will receive the following output from dotnet --info

>PS C:\Users\Administrator> dotnet --info
>
>Host (useful for support):
>  Version: 2.2.3
>  Commit:  6b8ad509b6 
>
>.NET Core SDKs installed:
>  No SDKs were found.
>
>.NET Core runtimes installed:
>  Microsoft.NETCore.App 2.2.3 [C:\Program 
>Files\dotnet\shared\Microsoft.NETCore.App]

When you install SDK you also get runtime in that. Check this below, this is what gets installed when we install SDK.

The following were installed at C:\Program Files\dotnet • .NET Core SDK 2.2.100 • .NET Core Runtime 2.2.0 • ASP.NET Core Runtime 2.2.0

참고URL : https://stackoverflow.com/questions/47733014/whats-the-difference-between-sdk-and-runtime-in-net-core

반응형