在 .NET 框架上运行 .NET 核心应用程序 [英] Running .NET core App on .NET framework

查看:29
本文介绍了在 .NET 框架上运行 .NET 核心应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读这篇文章: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/ 关于为 .NET 核心应用程序使用不同的名字,我想知道创建 ConsoleApp 之间有什么区别使用 .NET 框架 4.5.1 并创建 ConsoleApp .NET 核心,并将名称设置为 .net 框架 4.5.1.

I was reading this 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/ about using different monikers for .NET core app and I was wondering what is the difference between creating ConsoleApp with .NET framework 4.5.1 and creating ConsoleApp .NET core with moniker set to .net framework 4.5.1.

是否预期在行为上有任何差异?我能想到的唯一区别是第一个将使用 csproj,第二个将使用 xproj(好的,xproj 现在已弃用,因此使用新的 csproj 格式).我问这个问题是因为我当前的应用程序构建在 .NET 框架 4.5.1 之上,我正在考虑将它迁移到 .NET 框架之上的 .NET 核心.

Is it expected to have any differences in behavior? The only difference I can think of is that the first one will use csproj and the second one will use xproj (ok xproj is deprecated now, so new csproj format). I'm asking this question because my current app is built on top of .NET framework 4.5.1 and I was thinking of migrating it to .NET core on top of .NET framework.

推荐答案

将 project.json 构建工具称为.NET Core SDK"只是部分正确:这些工具可用于构建 .NET Core 以外的运行时,即 .NET 框架.使用 project.json 为 .NET Framework 构建的控制台应用程序与使用 csproj 为 .NET Framework 构建的控制台应用程序完全相同.

Calling the project.json build tools the ".NET Core SDK" was only partially true: the tools can be used to build for runtimes other than .NET Core, i.e. .NET Framework. A console app built for .NET Framework using project.json is exactly the same as a console app built for .NET Framework using csproj.

新的 csproj 格式试图纠正这种常见的混淆.您会注意到,在 VS 2017 中,项目使用.NET SDK",又名Microsoft.NET.Sdk"(从名称中删除了 Core).这个新的 SDK 可用于构建 .NET Framework、.NET Standard 和 .NET Core 项目.

The new csproj format tries to correct this common mixup. You'll notice in VS 2017, projects use the ".NET SDK", aka "Microsoft.NET.Sdk" (dropped Core from the name). This new SDK can be used to build .NET Framework, .NET Standard, and .NET Core projects.

这篇关于在 .NET 框架上运行 .NET 核心应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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