NuGet: How can I change property of files with Install.ps1 file?

后端 未结 2 1307
轻奢々
轻奢々 2021-01-30 22:50

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

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 23:55

    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
    

提交回复
热议问题