Include 3rd party DLLs in a NuGet package generated from a VS csproj
12:36 24 Sep 2018

I'm trying to create a NuGet package from a VS 2017 project that contains a reference to a 3rd party DLL (Kendo.mvc.dll). No matter what I try, I can't get nuget pack to automatically include that DLL in my NuGet package's lib folder.

I originally created the .nuspec file from the command line with the command nuget spec [project's name and path].csproj. I then tweaked the settings of that file which resulted in this .nuspec file:



  
    $id$
    $version$
    $title$
    our names
    $author$
    false
    the description
    First release
    Copyright 2018
    entity-framework-6 mvc5
  

I then used nuget pack to create the package, which resulted in this:

Package contents showing no 3rd party DLL was included

From what I've read in the documentation (MS Docs - Creating NuGet packages) I was expecting nuget pack to automatically include any non-nuget-sourced DLLs referenced in the project in the package, but that's not happening?

I've tried the following to see if it makes any difference, all to no avail:

  • Adding a lib folder to the root of my project and putting the DLL in there (and experimented a bit with changing the Build Action and Copy to Output Directory settings). That created a lib folder under the Content folder in the NuGet package, rather than adding the DLL to the same lib folder that contains the assembly's DLL. I did that because the MS docs talk about a convention based file structure.
  • Referencing the DLL from a folder in C:\Program Files and setting the Copy Local property for the DLL to true in the Properties

This question talks about adding a separate element for the 3rd party DLL which I'm guessing refers to adding the files explicitly in the .nuspec file before generating the package, e.g.

  
    
  

That does work, but shouldn't this be added automatically if it's needed when generating a .nuspec file from a csproj file?

visual-studio nuget nuget-spec