I agree the contentFile stuff confused me a bit too. It made a bit more
sense when I realised that it worked in addition to the existing `files`
elements. eg.

Here's an extract from a .nuspec I created. I'm including all .config
files. the <contentFiles> section then operates on files that it finds
under the contentFiles\* path from files put there by the second <file>
element.

(the first <file> element is left there for backwards compat with older
packages.config projects)

<?xml version="1.0"?>
<package>
  <metadata>


    <contentFiles>
      <files include="**\*.*" buildAction="Content" copyToOutput="false"
flatten="false" />
    </contentFiles>
  </metadata>
  <files>
    <file src="*.config" target="content\Lib\Configs\"/>
    <file src="*.config" target="contentFiles\any\any\Lib\Configs\"/>
  </files>
</package>

On Fri, 10 Apr 2020 at 10:09, Greg Keogh <[email protected]> wrote:

> I spent another 2 hours this morning trying to add a native dll to a nupkg
> file. I tried using a .targets file to update the target project to include
> the dll and set it to CopyIfNewer. There are confusing and conflicting and
> verbose discussions of this, but nothing I tried had any effect on the
> target project. Then I see there is this nuspec section:
>
> <contentFile>
>   <files include="..." buildAction="None" copyToOutput="true" />
> </contentFiles>
>
> Again there are ambiguous and vague explanations of how this works, even
> the official nuspec page is not authoritative. There's more confusion about
> the folder structure for contentFiles and if it's needed or not. It's all
> blithering confusion.
>
> In any case, I've just tried dozens of combinations of files and folders,
> including trivial sanity checks, but absolutely nothing will get any
> contentFiles folder in the package. It's as if the <contentFiles> is
> completely ignored always.
> Has anyone successfully used the <contentFiles> entry to add files to a
> target project?
>
> I've now spent 5 hours on this.
>
> *Greg K*
>
>
>
>

Reply via email to