.NET Core Runtime是否与以前的版本向后兼容? [英] Is .NET Core Runtime backwards compatible with previous releases?

查看:803
本文介绍了.NET Core Runtime是否与以前的版本向后兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我安装了.NET Core Runtime的最新版本(到目前为止,该版本为2.2.3):

If I've installed the latest version of the .NET Core Runtime (as of now, that's version 2.2.3):

https://dotnet.microsoft.com/download/dotnet-core/2.2

一个安装是否与以前版本的.NET Core向后兼容?

Is that one installation backwards-compatible with previous releases of .NET Core?

例如,上述安装是否与目标为:

For example, will the above installation be compatible with an app which targets:


  • netcoreapp1.0

  • netcoreapp2.0

  • netcoreapp2.1

  • netcoreapp2.2

  • netcoreapp1.0
  • netcoreapp2.0
  • netcoreapp2.1
  • netcoreapp2.2

我意识到.NET运行时可以并排安装。但是,这不能回答我的问题。 2.2版的安装是否向后兼容以前的版本,从而不需要额外的运行时?

I realize that the .NET runtimes can be installed side-by-side. However, that does not answer my question. Is the one 2.2 installation backwards compatible with previous releases, such that additional runtimes are not necessary?

推荐答案

编辑
.NET Core 3.x SDK已发布。与v2.2及其之前的发行版不同,此版本不支持定位以前的运行时的功能(即netcoreapp2.2,netcoreapp2.1等)

Edit .NET Core 3.x SDK has been released. Unlike v2.2 and the previous releases before it, this version does not support the ability to target previous runtimes (i.e. netcoreapp2.2, netcoreapp2.1, etc)

是。通过安装.NET Core Runtime 2.2.3,您可以运行针对netcoreapp2.0,netcoreapp2.1和netcoreapp2.2的应用程序,而无需安装其他运行时。

Yes. By installing .NET Core Runtime 2.2.3, you can run apps which target netcoreapp2.0, netcoreapp2.1, and netcoreapp2.2, without requiring additional runtimes to be installed.

Microsoft:

Microsoft:


。 ..NET Core运行时更新在主要版本
'band'内兼容,例如1.x和2.x。

...NET Core runtime updates are compatible within a major version 'band' such as 1.x and 2.x.

换句话说:
(同一主要版本中的次要更新是向后兼容的)

In other words: (Minor updates within the same major release are backwards compatible)

Microsoft:

Microsoft:


此外,.NET Core SDK的较新版本通常保持
的功能以兼容的方式构建以
运行时的早期版本为目标的应用程序

Additionally, newer releases of the .NET Core SDK generally maintain the ability to build applications that target previous versions of the runtime in a compatible manner

换句话说:
(最新的SDK可以定位以前的运行时)

In other words: (The latest SDK can target previous runtimes)

Microsoft:

Microsoft:


通常,您只需在应用程序所需的运行时中使用
的最新SDK和最新修补程序版本。

In general, you only need the latest SDK and latest patch version of the runtimes required for your application.

换句话说:
(通常来说,您只需要安装最新的SDK /运行时)

In other words: (Generally speaking, you should only need to install the latest SDK/runtime)

Microsoft:

Microsoft:


随着时间的流逝,当您安装.NET Core运行时
和SDK的更新版本时,您可能希望删除过时的版本s .NET Core从
您的计算机。删除较早版本的运行时可能会更改为运行共享框架应用程序而选择的
运行时

Over time, as you install updated versions of the .NET Core runtime and SDK, you may want to remove outdated versions of .NET Core from your machine. Removing older versions of the runtime may change the runtime chosen to run shared framework applications

换句话说:
(随着时间的推移并排安装其他SDK /运行时,您应该偶尔删除旧版本,而取而代之的是最新版本)

In other words: (As you install additional SDKs/runtimes side-by-side over time, you should occasionally remove older versions, in favor of the latest)

来源: https://docs.microsoft.com / en-us / dotnet / core / versions / remove-runtime-sdk-versions?tabs = windows

根据文档:


。NET Core 2.1是指.NET Core运行时版本数。
.NET Core运行时具有主要/次要/修补程序版本控制方式,
遵循语义版本控制。

".NET Core 2.1" refers to the .NET Core Runtime version number. The .NET Core Runtime has a major/minor/patch approach to versioning that follows semantic versioning.

换句话说,.NET Core运行时版本遵循语义版本控制方案:

In other words, .NET Core runtime releases follow the Semantic Versioning scheme:

[主要]。[次要]。[补丁]

其中:


  • 主要升级会带来重大变化

  • 具有小升级功能与先前的次要版本向后兼容的升级

  • 补丁升级通常是对现有功能的错误修复或安全补丁(也与先前的次要版本向后兼容)

因此,上述问题的答案基于语义版本控制:

So, the answer to the above question is based on Semantic Versioning:


  • 主要升级版本与先前主要版本

  • 较小和/或补丁程序升级在相同版本内向后兼容

  • Major upgrades are not backwards compatible with the previous major version
  • Minor and/or patch upgrades are backwards-compatible within the same version

.NET Core应用程序是内置/发布/还原的,它们的目标是主要版本和功能集,如运行时名称中的主要/次要版本号所示。因此, netcoreapp2.2 netcoreapp2.1 向后兼容,而 netcoreapp2.1 向后兼容。但是所有这些都与 netcoreapp1.x netcoreapp3.x 不兼容。

With this understanding, when .NET Core apps are built/published/restored, they target a major release and feature set as indicated by the major/minor version numbers found in the runtime name. So, netcoreapp2.2 is backwards compatible with netcoreapp2.1, which, in turn, is backwards-compatible with netcoreapp2.0. But all are incompatible with netcoreapp1.x or netcoreapp3.x.

带有.NET Core 2.1的一个安装.5运行时,并假设依赖于框架的发布部署,您将能够运行针对以下应用的应用程序:

With one installation of .NET Core 2.1.5 runtime, and assuming a framework-dependent publish deployment, you would be able to run apps targeting:


  • netcoreapp2.0

  • netcoreapp2.1

但不是:


  • netcoreapp1.0(不兼容)

  • netcoreapp2.2(尚不支持)

如果安装了多个运行时,则根据安装了最高补丁程序的最新运行时来选择确切的运行时。

If there are multiple runtimes installed, then the exact runtime is chosen based on the latest runtime installed with the highest patch.

SDK不基于语义版本控制。但是,每个SDK都针对最大的.NET Core运行时,并支持其之前的每个版本。

The SDK is not based on Semantic Versioning. However, each SDK targets a maximum .NET Core Runtime, and supports every version prior to it.

这意味着,您不需要安装多个 SDK (即使可以)。该SDK已经包含了所有必要的运行时,可以在现成的版本(或任何以前的版本)中自动构建应用程序。例如,如果安装.NET Core 2.2.105 SDK,则可以为netcoreapp1.0,netcoreapp2.0,netcoreapp2.1或netcoreapp2.2进行构建。但是您无法针对.NET Core 2.3或3.0进行构建。

That means, you don't need to install more than one SDK on your build server if you want to build against multiple runtimes (even though you could). The SDK already includes all the necessary runtimes to build applications on the current version (or any prior version) out-of-the-box. For example, if you install .NET Core 2.2.105 SDK, you can build for netcoreapp1.0, netcoreapp2.0, netcoreapp2.1, or netcoreapp2.2. But you can't build for .NET Core 2.3, or 3.0.

示例

假设我有一个构建服务器,该服务器安装了最新的.NET Core SDK
SDK 2.2.105-2.2.3运行时)。

Suppose I have a build server, which has the latest .NET Core SDK installed (SDK 2.2.105 - 2.2.3 Runtime).

不过,SDK 2.2.105已安装,我可能要构建并发布.NET Core 2.1应用程序:

Although, SDK 2.2.105 is installed, I might want to build and publish a .NET Core 2.1 app:

dotnet publish 
     /p:Configuration=Release -r win-x64 --self-contained false
     /p:IsWebConfigTransformDisabled=true --framework netcoreapp2.1
     /p:DebugSymbols=false /p:DebugType=None




  • / p:Configuration =发布-为发布配置

  • -r win-x64 -目标Windows部署(而非便携式)

  • -自包含false -依赖框架的部署(要求运行时为

  • / p:IsWebConfigTransformDisabled = true -不要转换web.config以避免默认web.config出错由Visual Studio生成(从2.1迁移到2.2时可能需要)

  • -framework netcoreapp2.1 -明确指定运行时框架

  • / p:DebugSymbols = false / p:DebugType = None -禁用.PDB文件

    • /p:Configuration=Release - configure for Release
    • -r win-x64 - target Windows deployment (rather than portable)
    • --self-contained false - Framework dependent deployment (requires runtime to be installed on host)
    • /p:IsWebConfigTransformDisabled=true - do not transform web.config to avoid errors with the default web.config generated by Visual Studio (may be needed when migrating from 2.1 to 2.2)
    • --framework netcoreapp2.1 - explicitly target a runtime framework
    • /p:DebugSymbols=false /p:DebugType=None - disable .PDB files
    • 此内部版本可以安装在具有最新运行时的生产服务器上。NET Core运行时+主机捆绑包2.2.3 -无需其他运行时(或SDK)

      This build could be installed on a Production server with the latest runtime .NET Core Runtime + Hosting Bundle 2.2.3 - no other runtimes (or SDK) are necessary

      希望这对其他人有帮助

      这篇关于.NET Core Runtime是否与以前的版本向后兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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