Just the other day I found a bug about a NullReferenceException on a missing library that should have been there since it comes from a nuget package we have uploaded.

Basically, I compiled a library class that referenced a few projects. On the build phase it would add the dll files to the bin folder but when packaging it as a nuget package and installing them in another solution, the dll files that I referenced and should be copied into the bin folder, are not there.

How to solve it

Solving this issue is pretty simple, you have to update the nuspec file and for each of the libraries that you want to copy, add the file in the files part.

<?xml version="1.0" encoding="utf-8"?>
<package >
    <license type="expression">MIT</license>
        <file src="bin\Release\MyFile1.dll" target="lib\net47" />
        <file src="bin\Release\MyFile2.dll" target="lib\net47" />
        <file src="bin\Release\MyFile3.dll" target="lib\net47" />
        <file src="bin\Release\MyFile4.dll" target="lib\net47" />