如何在ASP.NET Core 1.0 RC2项目中使用PCL [英] How to use PCL in ASP.NET Core 1.0 RC2 project
问题描述
我想使用带有目标的简单PCL(仅POCO,没有其他依赖项)
I want to use a simple (POCO only without other dependencies) PCL with targets
- Xamarin.Android
- 通用Windows 10
- ASP.NET Core 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
(您可以在此处了解更多信息:
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屋!