为什么我的PCL使用System.Runtime? [英] Why can't my PCL use System.Runtime?

查看:216
本文介绍了为什么我的PCL使用System.Runtime?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PCL是针对以下平台:

  • 在.NET框架4.5
  • 在Windows 8中
  • 的Windows Phone 8.1

我需要添加一个引用到 System.Runtime ,因为我想用另一个软件包依赖于它。从我所看到的,版本4.0.0 似乎包括目标平台上面提到的。然而,当我尝试通过的NuGet安装它,我得到这个堆栈跟踪:

  PM>安装,包装System.Runtime -Version 4.0.0
#...
安装失败。回滚...
包'System.Runtime 4.0.0项目不存在'PclDummy
包'System.Runtime 4.0.0文件夹中不存在C:\用户\詹姆斯\文档\ Visual Studio的2015年\项目\ PclDummy \包
安装,包装:无法安装包'System.Runtime 4.0.0。您正在尝试安装此包到该目标的.NETPortable,版本= V4.5,外形= Profile111'的一个项目,但不包
包含任何程序集引用或与该框架兼容的内容文件。欲了解更多信息,请联系包的作者。
 

为什么会出现这种情况,如果 System.Runtime 支持我的所有PCL做的平台?

解决方案
  

这是目标的.NETPortable,版本= V4.5,外形= Profile111

请务必引用的组件和的运行的组件之间进行区分。为了让您的PCL项目编译,你只需要引用程序集。而你已经有一个用于System.Runtime,它位于C:\ Program Files文件(x86)的\参考大会\微软\ Framework.NETPortable \ V4.5 \档案\你的机器上Profile111目录。它在你的项目中已经引用这样的包被正确地拒绝了。

这些类型的疯狂,但每个人都已经有了这个的NuGet包来自CoreCLR项目。它与以非常高的速度发布了测试版迅速发展,现在。这是由Profile111支持的目标之一,它支持一个ASP.NET 5.0的核心目标。没有一个你在你的问题中列出,所以你可能不需要它。但是,如果你会那么这将是的的项目,这个下载包中的NuGet。这是完全自动的,你不要问了明确的包。

只是停止试图把它安装。

I have a PCL that targets the following platforms:

  • .NET Framework 4.5
  • Windows 8
  • Windows Phone 8.1

I need to add a reference to System.Runtime because I want to use another package that depends on it. From what I can see, version 4.0.0 appears to include the target platforms mentioned above. However, when I try installing it via NuGet, I get this stack trace:

PM> Install-Package System.Runtime -Version 4.0.0
# ...
Install failed. Rolling back...
Package 'System.Runtime 4.0.0' does not exist in project 'PclDummy'
Package 'System.Runtime 4.0.0' does not exist in folder 'C:\Users\James\Documents\Visual Studio 2015\Projects\PclDummy\packages'
Install-Package : Could not install package 'System.Runtime 4.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not 
contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Why does this happen if System.Runtime supports all of the platforms my PCL does?

解决方案

that targets '.NETPortable,Version=v4.5,Profile=Profile111'

Be sure to distinguish between reference assemblies and runtime assemblies. To get your PCL project compiled, you only need reference assemblies. And you already have one for System.Runtime, it is located in the C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile111 directory on your machine. It is already referenced in your project so the package was correctly rejected.

These kind of crazy "but everybody already has this" Nuget packages come from the CoreCLR project. It is evolving rapidly right now with beta versions released at a very high rate. Which is one of the targets supported by Profile111, it supports an ASP.NET Core 5.0 target. Not one you listed in your question so you probably don't need it at all. But if you would then it would be that project that downloads this Nuget package. Which is entirely automatic, you don't ask for the packages explicitly.

Just stop trying to get it installed.

这篇关于为什么我的PCL使用System.Runtime?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆