将 C# 库转换为 Net.Core
Convert a C# Library to Net.Core
随着 .NET Core 越来越近,我将开始将我们的库转换为 NET-Core,以便它可以从我们的旧代码 (Net 4.5) 和 Net Core 中使用!但对我来说,我的图书馆应该是什么类型并不清楚。我在 VS2015 中没有 "Net-Core" 项目类型!我需要使用旧学校 "PCL" 图书馆吗?或者我该怎么做?
此时,在 RC1 中,您可以使用 ASP.NET 5 东西和 DNX。
有项目类型 Class Library
,项目扩展名为 xproj。
请记住,很多事情都在发生变化,包括 DNX will be retired in favor of dotnet cli, and more importantly the renaming of ASP.NET 5 to ASP.NET Core 1.0
您可以在使用这些项目模板时定位 dnxcore5 (or one of those new monikers)。
正在回复您的评论:
当您安装 ASP.NET 5 时,会为您添加新的 Visual Studio 项目模板。对于 Web 项目。 Class 库和控制台应用程序。全部使用 project.json
.
他们 roadmap has RC2 date as TBD 自从他们宣布重命名事物以来。还没有日期。
But for me it is not clear what Type should my Library be. I've no "Net-Core" Project Type in VS2015! Do I need to use old school "PCL" Library? Or how do I do it?
使用 Web > Class 库(包) 类型。
- 文件 > 新建 > 项目
- Web > Class 库(包)
截图来自Visual Studio Community 2015 Update 2 with ASP.NET 5 RC1 installed. Its project.json
targets two frameworks: .NET 4.5.1 and .NET 5.4 (renamed to .NET Core.)
{
// other properties deleted for clarity
"frameworks": {
"net451": { },
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
}
提示。当您升级 class 库时,run the .NET Portability Analyser 在现有代码上。它将显示必须更改的 classes 和成员。
随着 .NET Core 越来越近,我将开始将我们的库转换为 NET-Core,以便它可以从我们的旧代码 (Net 4.5) 和 Net Core 中使用!但对我来说,我的图书馆应该是什么类型并不清楚。我在 VS2015 中没有 "Net-Core" 项目类型!我需要使用旧学校 "PCL" 图书馆吗?或者我该怎么做?
此时,在 RC1 中,您可以使用 ASP.NET 5 东西和 DNX。
有项目类型 Class Library
,项目扩展名为 xproj。
请记住,很多事情都在发生变化,包括 DNX will be retired in favor of dotnet cli, and more importantly the renaming of ASP.NET 5 to ASP.NET Core 1.0
您可以在使用这些项目模板时定位 dnxcore5 (or one of those new monikers)。
正在回复您的评论:
当您安装 ASP.NET 5 时,会为您添加新的 Visual Studio 项目模板。对于 Web 项目。 Class 库和控制台应用程序。全部使用 project.json
.
他们 roadmap has RC2 date as TBD 自从他们宣布重命名事物以来。还没有日期。
But for me it is not clear what Type should my Library be. I've no "Net-Core" Project Type in VS2015! Do I need to use old school "PCL" Library? Or how do I do it?
使用 Web > Class 库(包) 类型。
- 文件 > 新建 > 项目
- Web > Class 库(包)
截图来自Visual Studio Community 2015 Update 2 with ASP.NET 5 RC1 installed. Its project.json
targets two frameworks: .NET 4.5.1 and .NET 5.4 (renamed to .NET Core.)
{
// other properties deleted for clarity
"frameworks": {
"net451": { },
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
}
提示。当您升级 class 库时,run the .NET Portability Analyser 在现有代码上。它将显示必须更改的 classes 和成员。