Please consider the following nuspec file:
<?xml version="1.0"?>
<package >
[SOME METADATA]
<files>
<file src="bin\x64\$configuration$\GR*.filetype" target="content\" />
</files>
</package>
The above has successfully packaged up the filetype files starting with 'GR' and has added them to my new, referencing, solution.
The problem is that I want these files to always be copied to the output directory. Can I do this via nuspec without having to manually amend the properties in my new solution?
Martin pointed out the right direction, I have same request before and kjbartel`s answer is nice to me. I post the answer here with more detail for you question, hope this can give you some help.
To resolve this question, you can follow below steps:
Add a xx.targets file in your project folder, make sure the name of the target file is the same name as the package id(TestDemo is my package ID, so the name of .targets is TestDemo.targets).
Add below code in the targets file:
Note: The path of "$(MSBuildThisFileDirectory)" should be relative path, if you are not familiar with it, you can use the absolute path.
In the nuspec file, add required file to the Build directory along with the targets file.
Pack this package, then add it on other project to test, it work fine.