NuGet Assembly outside lib folder

farina picture farina · Aug 8, 2012 · Viewed 43.6k times · Source

I'm going to bang out a couple of questions here...first, with NuGet is it possible to create a package from a few DLLs? There is no visual studio project, just the command line and a couple of pre-compiled DLL files.

Second, assuming that is possible, why do I continuously get the "Assembly outside of the lib folder" warning? I've tried everything I can think of to get associated assemblies to add themselves as references inside of the NuGet package.

My file structure looks like this

 Root
   - File1.dll
   - lib
     - File2.dll
     - File3.dll

When I tell NuGet to pack it using a .nuspec like this

<?xml version="1.0"?>
<package >
  <metadata>
    <id>File1.dll</id>
    <version>1.0.0</version>
    <authors>thisguy</authors>
    <owners>thisguysmom</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>This is some library</description>
    <releaseNotes>Porting to NuGet</releaseNotes>
    <copyright>Copyright 2012</copyright>
    <references>
      <reference file="File2.dll" />      
      <reference file="File3.dll" />
    </references>
  </metadata>
</package>

I receive that warning. From what I'm reading, I shouldn't even have to define the references node in any of my projects, as the lib folder items should automatically be added as references?

Does anyone out there understand this NuGet mess?

Answer

Jason Wall picture Jason Wall · Jan 14, 2015

I just ran into this problem. Nuget is expecting a structure that looks like:

root
  - lib
    - net40
      - File1.dll
      - File2.dll
      - File3.dll

net40 or net20 or net45 as appropriate to your .net version.

run

nuget pack yourlibrary.nuspec

to package it up.

That will pack up the dir wholesale and put it in the nupkg. The error messages will disappear at that point.