Installing a netstandard 2.0 NuGet package: Could not load file or assembly System.Runtime.Extensions

0

I have a little project I'm working on that is available as a NuGet package: Richiban.CommandLine. (You can see the source at https://github.com/Richiban/CommandLine).

The Richiban.CommandLine library targets netstandard 2.0. In the same solution it is being consumed by several other projects targeting .NET 4.7.1 and everything is fine.

If, however, you install the package through NuGet, you'll invariably get the following Exception:

'Could not load file or assembly 'System.Runtime.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

I am new to netstandard so I'm at a bit of a loss here. Why does everything work fine through project references, but not NuGet?

For reference, here's my package's nuspec file:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata>
    <id>Richiban.CommandLine</id>
    <version>0.2.0</version>
    <authors>Richiban.CommandLine</authors>
    <owners>Richiban.CommandLine</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Package Description</description>
    <dependencies>
      <group targetFramework=".NETStandard2.0" />
    </dependencies>
  </metadata>
</package>

I'm not referencing any dependencies in this project except for some Fody weavers which are marked as

  <PrivateAssets>all</PrivateAssets>

since they have no runtime components and don't need any binaries to be present.

What have I done wrong?

c#
nuget
.net-standard
asked on Stack Overflow Sep 21, 2018 by Richiban

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0