Skip to content

Latest commit

 

History

History
51 lines (38 loc) · 1.54 KB

File metadata and controls

51 lines (38 loc) · 1.54 KB
title NuGet Warning NU5131
description NU5131 Warning code
author zivkan
ms.date 09/20/2019
ms.topic reference
ms.reviewer karann
f1_keywords
NU5131

NuGet Warning NU5131

References were found in the nuspec, but some reference assemblies were not found in both the nuspec and ref folder. Add the following reference assemblies:
- Add AssemblyName.dll to the ref/net472/ directory

Issue

NuGet has a feature to allow package authors to select which assemblies will be available at compile time in projects that use the package.

If the required conventions are not followed, projects using the package with PackageReference may fail at runtime due to missing assemblies.

Solution

The list of assemblies in the nuspec file's <references> section should have matching assemblies in ref/<tfm>/.

For example, consider a package with the following files:

lib\net472\MyLib.dll
lib\net472\MyHelpers.dll
lib\net472\MyUtilities.dll

The package author wants to prevent package consumers from writing code that directly calls MyUtilities.dll, so they add the following to their nuspec file:

<references>
    <group targetFramework="net472">
        <reference file="MyLib.dll" />
        <reference file="MyHelpers.dll" />
    </group>
</references>

This package will not work as intended when using PackageReference. To fix this, the package must also contain the following files:

ref\net472\MyLib.dll
ref\net472\MyHelpers.dll