如何在 ASP.NET Core 1.0 RC2 项目中使用 PCL [英] How to use PCL in ASP.NET Core 1.0 RC2 project
问题描述
我想使用带有目标的简单(仅 POCO,没有其他依赖项)PCL
I want to use a simple (POCO only without other dependencies) PCL with targets
- Xamarin.Android
- 通用 Windows 10
- ASP.NET 核心 1.0
在 ASP.NET Core 1.0 RC2 项目中(都在同一个解决方案中).我已将此导入添加到我的 project.json:
in an ASP.NET Core 1.0 RC2 project (all in the same solution). I have added this import to my project.json:
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net451+win8"
],
"dependencies": {
"PCL.Library": {
"target": "project"
}
}
}
}
我没有收到任何错误(编译或其他)并且 PCL.Library
项目出现在参考文献中(没有警告标志或任何东西).但我无法在我的 ASP.NET Core 1.0 RC2 项目中使用它,因为 using 语句无法解析,就像根本没有引用 PCL 一样.
I don’t get any errors (compilation or otherwise) and the PCL.Library
project shows up in the references (without warning signs or anything). But I can’t use it in my ASP.NET Core 1.0 RC2 project because the using statements don’t resolve as if the PCL was not referenced at all.
我必须如何配置我的 PCL 项目和我的 ASP.NET Core 项目才能使用 PCL?
How do I have to configure my PCL project and my ASP.NET Core project so that I can use the PCL?
更新:它也不适用于 RTM 版本.开发团队对 GitHub 问题的任何回应都没有让我认为存在根本性的问题使这不可能实现.
Update: it does not work with the RTM version either. No reponse from the dev team on the GitHub issue leaves me thinking there is a fundamental issue making this impossible.
推荐答案
我相信这与以下内容有关:https://github.com/aspnet/Home/issues/1356
I believe this is related to: https://github.com/aspnet/Home/issues/1356
最好跟进此问题跟踪器并询问当前状态,尽管它表示 RC2 将支持它.
It might be best to follow up on this issue tracker and ask for the current status although it says it will be supported in RC2.
这是通过 netstandard
(https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md)
您可以在此处阅读更多相关信息:
You can read more about this here:
http://damien.dennehy.me/blog/2016/01/15/class-library-packages-future-class-libraries/
注意:我今天找到了一个关于定位 PCL 的文档:
Note: There's a doc I found today regarding targeting a PCL:
这篇关于如何在 ASP.NET Core 1.0 RC2 项目中使用 PCL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!