Question

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?

Was it helpful?

Solution

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top