johnny 5
johnny 5

Reputation: 20987

Nuget nuspec syntax

I'm creating a new nuget package in the nuspec file it seems they have a bizarre syntax $something$

<package >
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>$author$</authors>
  </metadata>
 </package>

What is this syntax $id$? Is this just a content placeholder so I can fill this in. Or is this a templating feature which will return the id variable? If it's the latter where do I declare these variables?

Upvotes: 0

Views: 352

Answers (1)

Christian.K
Christian.K

Reputation: 49250

They are replacement tokens, basically so that you can have a "generic" nuspec file.

For example, your build might decide upon the final package version and "stamp" it not only into your assemblies, but also in the package.

You could do something like this:

nuget.exe pack MyProject.csproj -properties version=1.3.3

That would then replace the "$version$" in the nuspec file.

All on that here.

Of course, if you like, you can use "plain text" instead.

Upvotes: 2

Related Questions