NuGet product used: VS UI
NuGet version (x.x.x.xxx): ?
dotnet.exe --version: 2.1.2
VS version: 2017
OS version: Windows 10
I'm trying to distribute some text files as a nuget package that a build tool needs - as such I need them available somewhere at build time. They are not actually in the working directory so I was hoping I could copy them to the ouput.
I have the following in my .nuspec file:
<?xml version="1.0"?>
<package>
  <metadata>
    ...
    <contentFiles>
      <files include="**\templates\**\*.*" buildAction="None" copyToOuput="true"  />
    </contentFiles>
  </metadata>
  <files>
    <file src="templates\**\*.*" target="contentFiles\any\any\templates" buildAction="None" copyToOutput="true" />
  </files>
</package>
I am using dotnet pack to create the nuget package and then installing this into my project via Visual Studio 2017.
All files appear correctly and with their buildAction marked as None but they all show Do not copy for Copy to Output Directory.
Any ideas how I can get this working would be greatly appreciated?
The current information is not enough to analyze the issue, can you please provide the nuspec from your
package, and the project.assets.json, props and targets file from restore?
Thanks.
Edit:
Just a clarification.
The files element that you use to include files in the nuspec, does not really set any attributes.
You can only set attributes such as buildAction in the metadata section. 
So
    <contentFiles>
      <files include="**\templates\**\*.*" buildAction="None" copyToOuput="true"  />
    </contentFiles>
is correct,
but the buildAction and copyToOutput here, is not needed.
  <files>
    <file src="templates\**\*.*" target="contentFiles\any\any\templates" buildAction="None" copyToOutput="true" />
  </files>
I realise buildAction and copyToOutput are not in the schema for files I was just experimenting to try and fix this.  Though actually I found that my buildAction was not set correctly with it specified merely in the contentFiles section.
Attached the files you've requested below (had to change them to txt files)
nuspec.txt
UIGeneration.Runner.csproj.nuget.g.props.txt
UIGeneration.Runner.csproj.nuget.g.targets.txt
project.assets.json.txt
The way content files are copied is that NuGet writes them in the props file and then later the build task picks them up.
From what I can see the nuget.g.props contains those files without copy local attributes because the package doesn't contain them.
Not sure I see anything being done wrong on the nuget side.
Can you please correct the packages and try building and then attach the msbuild log, in addition to the props and assets files.
Can you clarify what I need to correct please?
@hisuwh Just build the package with copyToOutput=true again in the metadata.
    <contentFiles>
      <files include="**\templates\**\*.*" buildAction="None" copyToOutput="true"  />
    </contentFiles>
FYI nuspec.txt file referenced above by @hisuwh has a spelling mistake in "copyToOuput" .. it's missing copyToOutput
Good spot @bradsa unfortunately this so old I don't think what I was working on this for exists anymore.
@hisuwh @bradsa Yes it helps me, I did the mistake. Thank you.
@MatthieuHernandez glad its not just me
Most helpful comment
@hisuwh @bradsa Yes it helps me, I did the mistake. Thank you.