Simplest way to package assemblies

Jun 23, 2011 at 2:15 PM
When I package libraries, like MyAssembly.dll, using:

nuget spec

nuget pack

That works great!

But the assembly is not added to the reference in the target project. To get the convention to work, am I forced to create a project file for each package?

What I would like be able to do is to just point to a directory with the convention folders (lib, tools, content) and then it would pack it together. Now I am forced to create a project for each one?


Jun 23, 2011 at 2:43 PM

The first command doesn't quite create a spec file the way you think it does. The spec command does not generate the files node, as a result the file tree is copied as-is to your package without correctly placing them in the right package directories.

So in this case, chances are MyAssembly.dll is getting copied to the root of your package instead of the lib directory. What you need to do is specify a files node in your spec file and tell it to target lib directory in your package.


   <file src="MyAssembly.dll" target="lib" />


Alternatively if you already have files copied to the right directories based on convention, nuget pack should work just fine.


Jun 26, 2011 at 5:35 AM

Awesome, that solved my problems! THANKS!