Home

Error adding xUnit.net nuget package

Hi,
When adding xUnit.net NuGet package to a query I receive the following error:
http://prntscr.com/kks38o
Maybe I'm doing something wrong, can anyone help?

Comments

  • edited August 2018
    The package relies on the xunit.abstractions package which is corrupt. Take a look at the [Content_Types].xml file in the nuget package file:
    <?xml version="1.0" encoding="utf-8"?>
    <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
      <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
      <Default Extension="psmdcp" ContentType="application/vnd.openxmlformats-package.core-properties+xml" />
      <Default Extension="dll" ContentType="application/octet" />
      <Default Extension="xml" ContentType="application/octet" />
      <Default Extension="psmdcp" ContentType="application/octet" />
      <Default Extension="nuspec" ContentType="application/octet" />
    </Types>
    
    Notice that the extension psmdcp is in there twice.

    The problem could be related to this:
    https://github.com/NuGet/Home/issues/5384

    I suspect that the reason it works in VS2017 is that Visual Studio uses msbuild in the toolchain rather than asking the package for its dependencies, so that file is never read. I need to call NuGet's LocalRepository.ResolveDependency method and this is where it crashes.
  • Update: try the latest beta. I've added code to identify and remove duplicate attributes from the NuGet package file. It should at least work for the xunit.abstractions package, or packages with similarly duplicated attributes. (I don't know what other kinds of corruption there might be in the file.)
  • Thank you for looking into this issue and for the detailed explanation.
    In the new beta, it works.
    Thank you.
Sign In or Register to comment.