Linux上的.net核心应用程序目标.net Framework 4.5.2 [英] .net core app target .net framework 4.5.2 on Linux

查看:496
本文介绍了Linux上的.net核心应用程序目标.net Framework 4.5.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想进一步了解点网核心支持。
我的基本理解是,如果我想在Linux上运行.net应用,则需要构建.net核心和目标netcoreapp1.0框架来保证这一点。
1)我认为上述假设是正确的吗?

I wanted to understand the dot net core support a bit more. My basic understanding was that if I wanted to run a .net app on Linux then it needs to be built .net core and targeted netcoreapp1.0 framework to guarantee this. 1) I assume the above assumption is correct?

2)当我在线阅读各种文章时,例如关于引用退出的.net框架项目的文章.net核心应用程序( https://www.hanselman.com/blog/HowToReferenceAnExistingNETFrameworkProjectInAnASPNETCoreCore10WebApp.aspx
如果执行此操作,那么大概该应用程序只能在Windows而非Linux上运行?

2) When I was reading various articles online, such as this one about referencing exiting .net framework project within a .net core application (https://www.hanselman.com/blog/HowToReferenceAnExistingNETFrameworkProjectInAnASPNETCore10WebApp.aspx) If I did this, presumably the app would only run on Windows and not Linux?

3)在以下文章中:
> https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks -以及-什么是目标框架monikers-tfms-关于/
在运行.net的上下文中运行4.5.2 optio n(
dotnet运行-f NET452 ),它被提到:

3) In the following article: https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about/ In context to running with .net run 4.5.2 option ( dotnet run -f NET452), it's mentioned:


如果该应用程序在.NET Core平台上运行,比如说在Linux盒子或Mac上,则不会执行此代码,但是
该应用程序仍将在Linux或MacOS上运行。

运行和不执行之间有什么区别?如果我最初的理解是正确的,那么通过在Linux上使用.net 4.5.2选项运行,我不会期望该应用程序根本不会运行。

What's the distinction between running and not executing? If my initial understanding was correct, then by running with .net 4.5.2 option on Linux I wouldn't expect the app not to run at all.

感谢一些还有问题,但真的想进一步了解.net核心。

Appreciate a few questions there but really wanted to understand .net core a bit more.

推荐答案

有区别.NET Core ASP.NET Core 以及您提到的文章都是关于运行 ASP.NET Core .NET Framework 上的$ c> apps。让我尝试使用一些声明性语句来澄清这一点:

There is a difference between .NET Core and ASP.NET Core and the articles you mentioned are about running ASP.NET Core "apps" on .NET Framework. Let my try to clarify this using a few declarative statements:


  • .NET Core 是跨平台运行时。

  • ASP.NET Core 是一组库,在1.1。*版之前可以运行$ b在 .NET Framework .NET Core 上都使用$ b。

  • 这意味着您可以创建 .NET Framework 应用程序(=>例如
    net452 ),并在此应用程序中使用 ASP.NET Core

  • CLI工具适用于两个目标 netcoreapp *
    net * -但 net * 当前仅在Windows上可用。

  • .NET Core is the cross-platform runtime.
  • ASP.NET Core is a set of libraries that until version 1.1.* can run on both .NET Framework and .NET Core.
  • This means you can create a .NET Framework application (=> e.g. net452) and use ASP.NET Corein this application.
  • The CLI tooling works for both projects targeting netcoreapp* and net* - but net* currently only works on windows.

这意味着对于 netcoreapp1。* ,则不能引用为.NET Framework构建的任意库。如果将目标框架更改为 net452 ,则您将不再构建.net核心应用程序,而是构建.net框架应用程序。

This means that for netcoreapp1.*, you cannot reference arbitrary libraries that have been built for .NET Framework. If you change the target framework to say net452, you are no longer building a .net core application, but a .net framework application.

对于 ASP.NET Core 2.0 ,这将有所改变。再说几句:

For ASP.NET Core 2.0 this is going to change. Again a few statements:


  • ASP.NET Core 2.0 仍然是一组库,但只能在 .NET Core 2.0 上使用,而不能在 .NET Framework
    $ b上使用$ b
    • ASP.NET Core 2.0 is still a set of libraries but they can only be used on .NET Core 2.0 and not on .NET Framework
      • Do note that this is still under discussion at the time of writing: https://github.com/aspnet/Home/issues/2022

      • 但是,如果某些库尝试使用<$上不可用的API方法,则在运行时可能会失败c $ c> .NET Core

      • However, some libraries may fail at run time if they try to use API methods that aren't available on .NET Core

      这篇关于Linux上的.net核心应用程序目标.net Framework 4.5.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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