2

I'm building a NuGet package in a build step in Jenkins (although Jenkins is probably unrelated).

I'm running NuGet command line like this:

NuGet Pack MyProject.csproj

There is also a MyProject.nuspec file in the same folder, I'm using a few variables like $id$, $version$, etc.

My nuspec only has a few files such as this:

<files>
    <file src="..\..\Build\MyProject.dll" target="lib\net40\MyProject.dll" />
    <file src="..\..\Build\MyProject.pdb" target="lib\net40\MyProject.pdb" />
    <file src="..\..\Build\MyProject.XML" target="lib\net40\MyProject.XML" />
</files>

My issue is that when there I inspect the built nupkg contents with 7zip, I notice there are additional files (dlls, pdb, xml, etc.) that happen to be in the Build folder I am pulling my files from.

These files are present from a previous build step, and will eventually be used in other NuGet packages (but I don't want them included in this main package).

What would cause NuGet to put extra files in the nupkg?

jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182
  • I just added a few more NuGet pack steps to my build process... Some have this same issue, and some don't. What is going on here? – jonathanpeppers Sep 09 '11 at 12:53

1 Answers1

3

When you pack from a project file it will include things marked as Content in your project. Also your nuspec file doesn't need to add the xml pdb and dll for that project unless it isn't in the TargetPath (msbuild property).

davidfowl
  • 37,120
  • 7
  • 93
  • 103
  • None of these extra files are marked as content... I just want to explicitly reference each file I want in the package. Then also use the csproj to take advantage of $id$, $version$, etc. variables. – jonathanpeppers Sep 09 '11 at 19:10
  • My project is open source, would you like to look at the specific example? – jonathanpeppers Sep 09 '11 at 19:44
  • http://nomvvm.codeplex.com/SourceControl/changeset/view/83514#1671114 To try it check it out with svn or TFS, build it, then run NuGet Pack with the NoMvvm.csproj file. Even if I remove all the files in the nuspec, it packs up everything named NoMvvm.* in the nupkg. – jonathanpeppers Sep 11 '11 at 20:21
  • Eventually I'd like to make several packages: NoMvvm, NoMvvm-MEF, NoMvvm-Ninject, NoMvvm-Unity, etc. and take advantage of dependencies. – jonathanpeppers Sep 11 '11 at 20:21
  • I ended up moving everything to a single NuGet package, this was much simpler for my scenario. Since you were the only help, you get the mark for answer. – jonathanpeppers Oct 20 '11 at 22:05