7

I created a nuget package. I put some files and folders in a "content" folder and it worked great. So I added a bin folder with dll's and put this in my nuspec file :

  <files>
     src="bin\*.dll" target="lib" />
  </files>

dll's are nicely put in the reference, but the content isn't copied anymore.

How can I manage to get them both working ?

@Edit

I know have this:

<file src="content\Controllers\*.*" target="Controllers" />
<file src="content\Views\Account\*.*" target = "Views\Account" />
<file src="bin\*.dll" target="lib" />

The package contains the right structure and files, but the files are not copied into my project.

The files are in a folder structure. When I put them directly into my content folder the are copied to the root of my project ...

1 Answer 1

13

When you define a files section in the nuspec we no longer do "automatic" / "Convention" based package creation. We see it as you are telling us what to include so we don't include things not in the list. Simply add the content folder to that list and it will work.

Edit to include comments from answerer's comment below

The NuSpec file "files" section tell NuGet where to put the files in the package not in sln/proj when it its unpacked. you want to write it like this:

<file src="content\Controllers*.*" target="content\Controllers" /> 
<file src="content\Views\Account*.*" target = "content\Views\Account" /> 
<file src="bin*.dll" target="lib" />
4
  • I tried that as well: <file src="content*" target="\" /> but it doesn work, unless I use the wrong syntax, can you then tell me what syntax to use?
    – Nealv
    May 6, 2011 at 8:38
  • 6
    The NuSpec file "files" section tell NuGet where to put the files in the package not in sln/proj when it its unpacked. you want to right it like this: <file src="content\Controllers*.*" target="content\Controllers" /> <file src="content\Views\Account*.*" target = "content\Views\Account" /> <file src="bin*.dll" target="lib" /> May 6, 2011 at 14:47
  • 3
    So the "content" folder means "root of my project"? Seems strange... and essentially undocumented. This page mentions the content folder but doesn't explain why it's special: nuget.codeplex.com/…
    – Paul Suart
    Aug 18, 2013 at 22:38
  • I think this seemingly simple and common thing in NuGet has been made very hard and arcane by the NuGet team. I've spent two days trying to make a simple package that deploys a handful of files. Aug 19, 2016 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.