After reading everything I could find about the new contentFiles
element of NuGet 3.3+, I still can't manage to make it work in my package. I've got a package that targets both net46
and uap10.0
, and the selection of the right DLLs for the project type and platform work as expected. But I would also like to add two files to the project on package installation, one CSV file for all projects and platforms, and one code file for either C# or VB.Net (with buildAction="Compile"
). Here's the abridged version of my latest .nuspec file:
<?xml version="1.0" encoding="utf-8" ?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="3.3.0">
...
<contentFiles>
<files include="any\any\ErrorCodes.csv" buildAction="None" copyToOutput="false" />
<files include="cs\any\Errors.cs.pp" buildAction="Compile" />
<files include="vb\any\Errors.vb" buildAction="Compile" />
</contentFiles>
</metadata>
<files>
<file src="contentFiles\any\any\ErrorCodes.csv" target="contentFiles\any\any\" />
<file src="contentFiles\cs\any\Errors.cs.pp" target="contentFiles\cs\any\" />
<file src="contentFiles\vb\any\Errors.vb" target="contentFiles\vb\any\" />
...
</files>
</package>
The package is created without errors, and it does contain the three files in the contentFiles folder with the specified directory structure.
But when I install the package - I tried it with with both an Universal App (C# and VB) and a .NET 4.6 console app I modified to use a project.json
file - the reference to the DLL is added, but the content files are neither added to the project structure, nor copied into the project directory.
I am thankful for any input!