如何在ASP.NET Core 1.0 RC2项目中使用PCL

编程入门 行业动态 更新时间:2024-10-19 23:42:36
本文介绍了如何在ASP.NET Core 1.0 RC2项目中使用PCL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用带有目标的简单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.

推荐答案

我认为这与以下内容有关: github/aspnet/Home/issues/1356

I believe this is related to: github/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( github/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md )

您可以在此处了解更多信息:

You can read more about this here:

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:

dotnet.github.io/docs/core-concepts/libraries/libraries-with-cli.html#how-to-target-a-portable-class-library-pcl

更多推荐

如何在ASP.NET Core 1.0 RC2项目中使用PCL

本文发布于:2023-11-14 19:43:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588348.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:项目   如何在   NET   ASP   Core

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!