I need my NuGet package to add a file to a project and set its "Copy to Output Directory" flag.
So far, I'm using install.ps1
script, as seen in the answer by @workabyte to Set content files to “copy local : always” in a nuget package.
But I've understood that NuGet 3.3 and newer has a native support using its contentFiles
model.
My understanding was that I create a directory structure like:
contentFiles\
any\
any\
image.png
And then in my .nuspec
:
<?xml version="1.0"?>
<package>
<metadata minClientVersion="3.3.0">
...
<contentFiles>
<files include="**/*.png" buildAction="None" copyToOutput="true" />
</contentFiles>
</metadata>
</package>
When the package is compiled, the image.png
with its directory structure is added to the .nupkg
.
But, when I install the package in Visual Studio (2017), the image.png
is not even added to the project.
What am I doing wrong?