Specifying Files to Include in a Package

By convention, you do not have to explicitly specify a list of files in the .nuspec file. In some cases, however, it may be useful to explicitly list the files in your project that should be included in the NuGet package. Do note that if you specify any files, the conventions are ignored, and only the files listed in the package manifest are included in the package.

The files element is an optional child element of the package element and contains a set of file elements. Each file element specifies the source and destination of a file to include in the package via the src attribute and target attribute, respectively.

Table A-4 lists the possible attributes of the file element.

File Element Examples

Get Pro NuGet now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.