NuGet: Include .pdb Files and Exclude Content Folder

I included the following line in CI-build to create a private NuGet package for each build :

nuget pack C:\Projects\Test\Test.vbproj -OutputDirectory \\nas1\NuGet 

AssemblyInfo is read (including the version number ) and a NuGet package is created.
I would like the package to include .pdb files and not contain the “Content” folder (so only “lib”).

How can I change the command for this?

+8
visual-studio nuget nuget-package
source share
3 answers

Unfortunately, I do not think that you can both exclude content files and include .pdb files during packaging through the project. You could do one or the other.

First, create a nuspec file (the nuget spec command does this quickly) and place it in the same place as your project. When you pack your project, NuGet.exe will consider the specification as an addition to your project information.

To exclude the content folder, when packing a project that also has a .nuspec file, an empty <files /> node parameter in the specification indicates that you do not want the content files, even if they exist in the project.

To include debug files, add something like this to your specification:

  <files> <file src="bin\*.pdb" target="lib\net35\" /> </files> 

but this will tell the tool that you have the content, and then it will add all the other files. You could possibly make a character pack for your project.

Another option is to create exclusively from the specification ( nuget pack Test.nuspec ) and specify exactly the files that you want to include. This takes longer, but gives you full control over the contents of the package.

+11
source share

In content files that you don’t want to pack, do you need the “Content” action to be created in your project (in the file properties window in Visual Studio, if this is your IDE)?

If it is permissible to change the assembly action to “No” (or something else), it will not be in the content folder.

+1
source share

The following solution works - if you don't mind, including the source files. To ignore content files, add such an empty node to your nuspec:

 <files> </files> 

And then run:

 nuget pack C:\Projects\Test\Test.vbproj -Symbols nuget push *.symbols.nupkg -Source \\nas1\NuGet 
0
source share

All Articles