PCL project not compiling after updating all the installed NuGet portable libraries

随声附和 提交于 2019-12-10 19:07:05

问题


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?


回答1:


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>



回答2:


Make sure your PCL version supports the dependencies you need. Here is a spreadsheet regarding the current support courtesy of CheeseBaron.

https://docs.google.com/spreadsheet/pub?key=0AgHEgqqaasTkdDVMQWNURUNhSUdlZzV0Z2p3djlLQ3c&single=true&gid=3&output=html

Note - Because this is still in it's infancy of supporting certain libraries, you'll have to find the right one that works for your project.



来源:https://stackoverflow.com/questions/20196552/pcl-project-not-compiling-after-updating-all-the-installed-nuget-portable-librar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!