0

I have a nuspec template file (template.nuspec.pp) in the content folder of a Nuget package. When the package is installed, I modify the name of the nuspec file using an install.ps1 script to match the targeted assembly. I want the contents of the nuspec file to remain unchanged:

<?xml version="1.0"?>
<package>
  <metadata>
    <id>$rootnamespace$</id>
    <version>$version$</version>
    <title>$rootnamespace$</title>
    <authors>$author$</authors>
    <!--<iconUrl></iconUrl>-->
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$rootnamespace$</description>
    <copyright>$copyright$</copyright>
    <tags></tags>
  </metadata>
</package>

The replacement tokens are replaced immediately on installation, however - I was under the impression this should happen only when nuget pack is called. Why is this happening, and what need I do to prevent it?

In case folks wonder, my install.ps1 file is not touching the contents of the nuspec template.

ket
  • 728
  • 7
  • 22

1 Answers1

0

Looks like the whole point of the .pp suffix is to denote that any variable enclosed by $ is replaced on package install. When I removed the .pp suffix, the files were then ignored by Nuget and not added to the content folder. In order to circumvent this, I had to add a non .pp suffix to the file (I used .txt) and then renamed it using an install.ps1 script in my tools folder.

ket
  • 728
  • 7
  • 22