Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet: include .pdb files and exclude the "Content" folder

I've incorporated the following line in the CI-build to create a private NuGet package on each build:

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

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

How can I change the command to do that?

like image 946
David Avatar asked Jan 31 '12 14:01

David


People also ask

Should I include pdb files in NuGet package?

Actually you should add -Symbols to the end of command to create a symbols package. You shouldn't add pdb files to main nuget package.

How do I exclude a PDB file?

If you want to disable pdb file generation, you need to use the "Advanced build settings" dialog available in project properties after clicking the "Advanced..." button" located in the lower part of the Build tab. Set Output - Debug info: to None for release build configuration and no pdb files will be generated.

How do I use a Nupkg file?

NUPKG files help developers fetch the latest packages from Nuget.org using NuGet Package Manager instead of manually downloading and installing the development packages. NUPKG files are built from NUSPEC files and, when fetched, install the package on user system.


1 Answers

Unfortunately, I don't think you'll be able to both exclude the content files and include the .pdb files while packing via the project. You could do one or the other.

First, make a nuspec file (the nuget spec command makes this quick) and put it in the same location as your project. When you pack your project, NuGet.exe will treat the spec as a supplement to your project's info.

To eliminate the content folder, when packing a project that also has a .nuspec file, an empty <files /> node in the spec will indicate that you don't want any content files, even if they exist in the project.

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

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

but that would tell the tool that you do have content, and then it would add all the other files, as well. You could, perhaps, make a symbol package for your project, instead.

Another option would be to build exclusively from the spec (nuget pack Test.nuspec), and specify exactly the files you want to include. It's more time consuming, but it gives you complete control over the package's contents.

like image 57
brainiac10 Avatar answered Sep 16 '22 12:09

brainiac10