nuget pack content files only

Yes. You can create a .nuspec file that simply references the content files.

You must use nuget pack MyPackage.nuspec

Don't pack the .csproj file as that causes NuGet to include the built assembly.

See http://docs.nuget.org/create/nuspec reference for more info.


To package a file as content, you must use target=content when listing the file in your .nuspec document.

To create a 'content only' nuget package, you must use a <files> node to list the files.

A <files> node must be a sibling of the <metadata> node.

A <file> node must be a child of a <files> node.

To include a file as content, set the target attribute in a <file> node to 'content'.

Example:

  <files>
    <file src="{filePath}" target="content"/>
  </files>

As previously mentioned, you must then pack the .nuspec file rather than a .csproj file:

nuget pack *.nuspec

I found the target=content trick here:

https://docs.microsoft.com/en-us/nuget/reference/nuspec#including-content-files

Tags:

Package

Nuget