runtime: System.Runtime.WindowsRuntime adds incorrect Binding Redirects

Repro steps:

  • Create a .NETStandard Library project
  • Reference the Contracts NuGet pkg
  • Use some types in the library that use IAsyncOperation
  • Create a WPF project
  • Reference the library project
  • build

You will notice that the .exe.config gets generated with this binding redirect:

      <dependentAssembly>
        <assemblyIdentity name="System.Runtime.WindowsRuntime" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.14.0" newVersion="4.0.14.0" />
      </dependentAssembly>

And since in your .NuGet package you are not copying the System.Runtime.WindowsRuntime.dll locally this will fail as it cannot find the assembly from the NuGet package.

System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'System.Runtime.WindowsRuntime, Version=4.0.14.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

/cc @jeffschwMSFT

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (19 by maintainers)

Most upvoted comments

The contracts package uses refs that are not supported with packages.config

Yeah, but it also has targets which can do the same thing as ref on packages.config… Granted that too will depend on targets, ironically packages.config always applies targets from transitive dependencies so it won’t be impacted by this issue.

wasn’t this issue about targets that affect the . NET Framework?

Correct, we want this stuff to work downlevel & in desktop projects. I’m not opposed to duplicating the folders, though it seems a little unusual. I’d still like to get the package heirarchy fixed so that the packages that distribute these don’t suppress meaningful functionality in their dependencies.