Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange behavior with NuSpec $version$ replacement for pre-release packages
    primarykey
    data
    text
    <p>I have a project that is comprised of a core nuget package, and then several additional extension packages.</p> <p>The core package has a nuspec that looks like this:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;package&gt; &lt;metadata&gt; &lt;id&gt;$id$&lt;/id&gt; &lt;version&gt;$version$&lt;/version&gt; &lt;title&gt;The Core Package&lt;/title&gt; &lt;authors&gt;$author$&lt;/authors&gt; &lt;owners&gt;$author$&lt;/owners&gt; &lt;description&gt;$description$&lt;/description&gt; &lt;/metadata&gt; &lt;/package&gt; </code></pre> <p>And, in each extension package, I have a nuspec like this:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;package&gt; &lt;metadata&gt; &lt;id&gt;$id$&lt;/id&gt; &lt;version&gt;$version$&lt;/version&gt; &lt;title&gt;A Extension Package&lt;/title&gt; &lt;authors&gt;$author$&lt;/authors&gt; &lt;owners&gt;$author$&lt;/owners&gt; &lt;dependencies&gt; &lt;dependency id="The.Core" version="$version$"/&gt; &lt;/dependencies&gt; &lt;/metadata&gt; &lt;/package&gt; </code></pre> <p>I use the same $version$ token to rev all packages at once when a release build is ran. This makes the dependency on the core move forward whenever I do a release.</p> <p>Now, I've been using this as on a private nuget feed and it has been working great. However, I wanted to release these packages to public nuget as a prerelease. I setup the Assembly Version attributes to look like this on ALL of the assemblies:</p> <pre><code>[assembly: AssemblyFileVersion("1.0.1")] [assembly: AssemblyInformationalVersion("1.0.1-alpha")] </code></pre> <p>However, when I run nuget pack (From my build server), it doesn't seem to be picking up 1.0.1-alpha as the version for the package:</p> <pre><code>[pack] Starting NuGet.exe 2.7.40906.75 from C:\TeamCity\buildAgent\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe [14:21:46][pack] WARNING: Option 'Verbose' has been deprecated. Use 'Verbosity' instead. [14:21:46][pack] Attempting to build package from 'The.Core.csproj'. [14:21:46][pack] Packing files from 'C:\TeamCity\buildAgent\work\857bd09f14af8e44\src\The.Core\bin\Release'. [14:21:46][pack] Using 'The.Core.nuspec' for metadata. [14:21:46][pack] [14:21:46][pack] Id: The.Core [14:21:46][pack] Version: 1.0.1 [14:21:46][pack] Authors: Jonathan Holland [14:21:46][pack] License Url: http://www.apache.org/licenses/LICENSE-2.0 [14:21:46][pack] Dependencies: None [14:21:46][pack] [14:21:46][pack] Added file 'lib\net40\The.Core.dll'. [14:21:46][pack] [14:21:46][pack] Successfully created package 'C:\TeamCity\buildAgent\work\Publish\The.Core.1.0.1.nupkg'. [14:21:46][pack] Process exited with code 0 </code></pre> <p>You can see that it picked up 1.0.1 as the version, and not 1.0.1-alpha like I expected.</p> <p>Things get weirder when the build server attempts to pack the first extension:</p> <pre><code>[pack] Starting NuGet.exe 2.7.40906.75 from C:\TeamCity\buildAgent\tools\NuGet.CommandLine.DEFAULT.nupkg\tools\NuGet.exe [14:21:46][pack] WARNING: Option 'Verbose' has been deprecated. Use 'Verbosity' instead. [14:21:46][pack] Attempting to build package from 'The.Core.Extension.csproj'. [14:21:46][pack] Packing files from 'C:\TeamCity\buildAgent\work\857bd09f14af8e44\src\he.Core.Extension\bin\Release'. [14:21:46][pack] Using 'The.Core.Extension.nuspec' for metadata. [14:21:46][pack] Found packages.config. Using packages listed as dependencies [14:21:46][pack] A stable release of a package should not have on a prerelease dependency. Either modify the version spec of dependency "The.Core (ò 1.0.1-alpha)" or update the version field. [14:21:46][pack] Process exited with code 1 </code></pre> <p>So, here we have a failure because $version$ in the dependancy section of the nuspec was properly replaced with "1.0.1-alpha", however in the version node, it was replaced with 1.0.1.</p> <p>This is really bizarre behavior, so I have to be doing something totally wrong. I assumed it was as simple search and replace token for nuspecs, but there must be some sort of context to how the token behaviors work.</p> <p>I want the &lt;version&gt; node on both nuspecs to use the version from AssemblyInformationalVersion, and they should as far as I can tell from the docs.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload