.Net Framework和.Net Core在同一解决方案中 [英] .Net Framework and .Net Core in same solution
问题描述
我有一个针对.NET Framework的应用程序,现在我需要在.NET Core中开发一个库.我计划将两个项目放在相同的解决方案中,并将.NET Core库添加为.NET Framework项目中的引用.
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/zh-我们/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.
由于该项目支持Windows上的.NET Framework和Linux/OSX上的Mono,因此我们正在积极讨论使用pythonnet的方式.现在,我们添加了跨平台的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屋!