更新所有已安装的NuGet可移植库后,PCL项目无法编译 [英] PCL project not compiling after updating all the installed NuGet portable libraries

查看:83
本文介绍了更新所有已安装的NuGet可移植库后,PCL项目无法编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的便携式类库项目中,一切工作正常,直到 我更新了所有已安装的可移植库. 它已停止编译.对于已安装的nuget库,引发以下错误.

C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Common.targets(1605,5):警告MSB3268:主引用 "System.Threading.Tasks" 无法解析,因为它与框架程序集"System.Runtime,版本= 2.6.3.0,文化=中性,PublicKeyToken = b03f5f7fd11d50a3a"具有间接依赖性,在当前目标框架中无法解决. ".NETPortable,版本= v4.0,配置文件= Profile104".要解决此问题,请删除引用"System.Threading.Tasks",或将应用程序重新定位到包含"System.Runtime,Version = 2.6.3.0,Culture = neutral,PublicKeyToken = b03f5f7fd11d50a3a"的框架版本.

1> C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Common.targets(1605,5):警告MSB3268:主引用 "System.Net.Http.Extensions" 不能是已解决,因为它与框架程序集"System.Runtime,版本= 2.6.3.0,文化=中性,PublicKeyToken = b03f5f7fd11d50a3a"具有间接依赖关系,而在当前目标框架中无法解决. ".NETPortable,版本= v4.0,配置文件= Profile104".要解决此问题,请删除引用"System.Net.Http.Extensions",或将应用程序重新定位到包含"System.Runtime,版本= 2.6.3.0,Culture = neutral,PublicKeyToken = b03f5f7fd11d50a3a"的框架版本.

1> C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Common.targets(1605,5):警告MSB3268:主引用 "Microsoft.Threading.Tasks.Extensions" 不能是已解决,因为它对框架程序集"System.Runtime,版本= 2.6.3.0,文化=中性,PublicKeyToken = b03f5f7fd11d50a3a"具有间接依赖关系,而在当前目标框架中无法解决. ".NETPortable,版本= v4.0,配置文件= Profile104".要解决此问题,请删除引用"Microsoft.Threading.Tasks.Extensions",或将应用程序重新定位到包含"System.Runtime,版本= 2.6.3.0,Culture = neutral,PublicKeyToken = b03f5f7fd11d50a3a"的框架版本. >

1> C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Common.targets(1605,5):警告MSB3268:主引用 "PCLStorage" 不能是已解决,因为它与框架程序集"System.Runtime,版本= 2.6.3.0,文化=中性,PublicKeyToken = b03f5f7fd11d50a3a"具有间接依赖关系,而在当前目标框架中无法解决. ".NETPortable,版本= v4.0,配置文件= Profile104".要解决此问题,请删除引用"PCLStorage",或将应用程序重新定位到包含"System.Runtime,版本= 2.6.3.0,Culture = neutral,PublicKeyToken = b03f5f7fd11d50a3a"的框架版本.

1> C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Common.targets(1605,5):警告MSB3268:主引用 "Microsoft.Threading.Tasks" 不能是已解决,因为它与框架程序集"System.Runtime,版本= 2.6.3.0,文化=中性,PublicKeyToken = b03f5f7fd11d50a3a"具有间接依赖关系,而在当前目标框架中无法解决. ".NETPortable,版本= v4.0,配置文件= Profile104".要解决此问题,请删除引用"Microsoft.Threading.Tasks"或将应用程序重新定位到包含"System.Runtime,版本= 2.6.3.0,Culture = neutral,PublicKeyToken = b03f5f7fd11d50a3a"的框架版本.

1> C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Common.targets(1605,5):警告MSB3268:主引用 "System.Net.Http" 不能是已解决,因为它与框架程序集"System.Runtime,版本= 2.6.3.0,文化=中性,PublicKeyToken = b03f5f7fd11d50a3a"具有间接依赖关系,而在当前目标框架中无法解决. ".NETPortable,版本= v4.0,配置文件= Profile104".要解决此问题,请删除引用"System.Net.Http",或将应用程序重新定位到包含"System.Runtime,版本= 2.6.3.0,Culture = neutral,PublicKeyToken = b03f5f7fd11d50a3a"的框架版本.

1> C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Common.targets(1605,5):警告MSB3268:主引用 "PCLStorage.Abstractions" 不能是已解决,因为它与框架程序集"System.Runtime,版本= 2.6.3.0,文化=中性,PublicKeyToken = b03f5f7fd11d50a3a"具有间接依赖关系,而在当前目标框架中无法解决. ".NETPortable,版本= v4.0,配置文件= Profile104".要解决此问题,请删除引用"PCLStorage.Abstractions",或将应用程序重新定位到包含"System.Runtime,版本= 2.6.3.0,Culture = neutral,PublicKeyToken = b03f5f7fd11d50a3a"的框架版本.

如何将其指向 System.Runtime 2.6.3.0版?

解决方案

解决了该问题.

PCL项目的 app.config 指向System.Runtime的2.6.3.0版本.我将其更改为指向上一个版本1.5.11.0,并且编译良好.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
   //   <!--  <bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" /> -->
        <bindingRedirect oldVersion="0.0.0.0-1.5.11.0" newVersion="1.5.11.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Everything was working fine in my Portable-Class-Library project until I updated all the installed portable libraries. It has stopped compiling. Throws the following errors for the nuget libraries installed.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "System.Threading.Tasks" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "System.Threading.Tasks" or retarget your application to a framework version which contains "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a".

1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "System.Net.Http.Extensions" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "System.Net.Http.Extensions" or retarget your application to a framework version which contains "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a".

1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "Microsoft.Threading.Tasks.Extensions" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "Microsoft.Threading.Tasks.Extensions" or retarget your application to a framework version which contains "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a".

1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "PCLStorage" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "PCLStorage" or retarget your application to a framework version which contains "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a".

1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "Microsoft.Threading.Tasks" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "Microsoft.Threading.Tasks" or retarget your application to a framework version which contains "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a".

1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "System.Net.Http" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "System.Net.Http" or retarget your application to a framework version which contains "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a".

1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference "PCLStorage.Abstractions" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "PCLStorage.Abstractions" or retarget your application to a framework version which contains "System.Runtime, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b03f5f7fd11d50a3a".

How to point it to System.Runtime version 2.6.3.0?

解决方案

Fixed the problem.

The PCL project's app.config was pointing to 2.6.3.0 version of System.Runtime. I changed it to point to 1.5.11.0, the previous one, and it compiled fine.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
   //   <!--  <bindingRedirect oldVersion="0.0.0.0-2.6.3.0" newVersion="2.6.3.0" /> -->
        <bindingRedirect oldVersion="0.0.0.0-1.5.11.0" newVersion="1.5.11.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

这篇关于更新所有已安装的NuGet可移植库后,PCL项目无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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