.Net Framework 和 .Net Core 在同一个解决方案中 [英] .Net Framework and .Net Core in same solution
问题描述
我有一个面向 .NET Framework 的应用程序,现在我需要在 .NET Core 中开发一个库.我计划将两个项目放在同一个解决方案中,并在 .NET Framework 项目中添加 .NET Core 库作为参考.
I have an application targeting .NET Framework, and now I need to develop a library in .NET Core. I plan to put both projects in the same solution and add the .NET Core library as a reference in the .NET Framework project.
这能做到吗?如果答案是肯定的,如何做到这一点?
Can this be done? If the answer is yes, how can this be done?
推荐答案
2017 年 4 月发表了一篇关于如何从同一解决方案支持两种运行时的文章:
There is an article published in April 2017 on how to support both runtimes from the same solution:
https://docs.microsoft.com/en-us/dotnet/core/porting/project-structure
归结为两种方法:
- 在同一个项目中配置了两个框架(例如 *.csproj):
用多目标 .NET Core 项目替换现有项目.
Replace existing projects with a multi-targeted .NET Core project.
- 为每个框架有一个单独的项目:
保留现有项目并创建一个 .NET Core 项目.
Keep existing projects and create a .NET Core project.
我们正在积极讨论 Pythonnet 的发展方向,因为该项目支持 Windows 上的 .NET Framework 和 Linux/OSX 上的 Mono.现在我们正在添加跨平台 pythonnet 支持:
We are actively discussing which way to go in pythonnet, since the project supports .NET Framework on Windows and Mono on Linux/OSX. Now we are adding cross-platform pythonnet support:
https://github.com/pythonnet/pythonnet/pull/518
这篇关于.Net Framework 和 .Net Core 在同一个解决方案中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!