I'm building a NuGet package with a folder hierarchy that looks like this:
ProjectDir
Infrastructure
class1.cs
class2.cs
Task
class3.cs
class3.cs
StuffToInclude
SampleCode
sampleclass1.cs.pp
sampleclass2.cs.pp
Images
image1.gif
image2.gif
Doc
text1.txt
text2.txt
Project.nuspec
Note the nuspec file is generated simply with the "nuget spec" command, and then the following file section is added:
<files>
<file src="StuffToInclude\**\*.*" target="content" />
</files>
What I would expect (and want) is a content folder in the package that looks like this:
content
SampleCode
sampleclass1.cs.pp
sampleclass2.cs.pp
Images
image1.gif
image2.gif
Doc
text1.txt
text2.txt
What I get however is a slightly larger content folder that includes a second copy of the "StuffToInclude" folder, looking like this:
content
StuffToInclude
Images
image1.gif
image2.gif
Doc
text1.txt
text2.txt
SampleCode
sampleclass1.cs.pp
sampleclass2.cs.pp
Images
image1.gif
image2.gif
Doc
text1.txt
text2.txt
Notice that the undesired StuffToInclude folder does not have the SampleCode subfolder in it -- somehow the nuget packer figured out that ".pp" files should not be placed in the content unless explicitly asked for. But all those other files (in all the other folders) are unnecessarily duplicated and it is not desirable to have them there - because when the package is consumed, that folder is also duplicated in the target project.
I thought perhaps something like this in the nuspec would help:
<files>
<file src="StuffToInclude\**\*.*" target="content" exclude="StuffToInclude\**\*.*"/>
</files>
but all variants I have tried for the "exclude" attribute don't seem to help.
How do I exclude the "StuffToInclude" file from being included in the content folder?
Many thanks.