I am creating NuGet package and for that I have created Nuspec manifest file. In content
folder I have two files, test.exe
and test.config
. Now I would like to change property "Copy To Output Directory" of these the files to "Copy Always" in project, when any user installs this package.
I found related question NuGet how to apply properties to files, that shows can do this using PowerShell install.ps1
script, but I have no idea how to create that file.
Your install.ps1 file should look something like this.
param($installPath, $toolsPath, $package, $project)
$file1 = $project.ProjectItems.Item("test.exe")
$file2 = $project.ProjectItems.Item("test.config")
# set 'Copy To Output Directory' to 'Copy if newer'
$copyToOutput1 = $file1.Properties.Item("CopyToOutputDirectory")
$copyToOutput1.Value = 2
$copyToOutput2 = $file2.Properties.Item("CopyToOutputDirectory")
$copyToOutput2.Value = 2