Create .nuspec file from .csproj file ends up with additional assemblies packaged in Lib folder

Aug 2, 2011 at 9:27 PM

When I create a .nuspec file from a .csproj file, and then create the package using nuget pack, I end up with a package that contains additional assemblies in the lib folder.  All of the assemblies contain the same namespace reference of the desired assembly.  Packaging the project file abc.csproj file will give me other assemblies that start with the same namespace, but have extensions on their names.  For example:

  1. a.b.c.dll
  2. a.b.c.d.dll
  3. a.b.c.e.dll

All I really want is the a.b.c.dll file packaged. Can I filter what the command packages? 

Aug 2, 2011 at 9:39 PM

There shouldn't be any logic that includes assemblies based on them starting with a given prefix. Where do these other assemblies come from? Are they things that are imported by your project?

Aug 2, 2011 at 9:46 PM

The other assemblies appear in the bin folder as a result of project references in the abc project file.  These other projects contain the same namespace  reference.

Aug 2, 2011 at 9:50 PM

If project A has a reference to project B, and you build a package for project A, it will indeed include the B assembly in there (without which A presumably couldn't run). But note that this has nothing to do with the name of the assemblies being a prefix.

As an aside, the term namespace is never used for assembly names, but only for type names. Just to avoid some confusion :)

Aug 2, 2011 at 9:58 PM

David:  

So these other assemblies are included as a result of dependencies, and nothing to do with the fact that they conatin ths same name reference as the assembly built from the project file.

Aug 2, 2011 at 9:59 PM

Maybe I'm misunderstanding you. Can you clarify what you mean by "they contain the same name reference".

Aug 2, 2011 at 10:06 PM

David:

 

Sorry for the confusion.  I think that what you are saying is that these other assemblies show up in the lib folder as a result of the fact that they are project references in the .csproj file that is used to generate the package.

Aug 2, 2011 at 10:12 PM

Yes, exactly!