question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make dotnet pack usage more CI / build system friendly

See original GitHub issue

Steps to reproduce

Assume, that have a project.json with a version placeholder (e.g. 1.0.0). It would be nice, if there would be a way for a CI system (like TeamCity) to update this version number without requiring the usage of regular expressions.

Expected behavior

One or more of the following:

  • Support for $version$ as version value.
  • Support for --version parameter

The $version$ would get replaced by the version of the AssemblyInformationalVersionAttribute or (when the former is missing), the value of the AssemblyVersionAttribute. The --version parameter would enforce the usage of the given version (and thus overriding the found assembly version).

Actual behavior

dotnet pack uses the version from the project.json and the CI system (like TeamCity) must patch the project.json, which is error prone, because it must not update the version values of dependencies.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc2-002485)

Product Information:
 Version:     1.0.0-rc2-002485
 Commit Sha:  d3c65aee87

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:11
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
yishaigalatzercommented, Apr 27, 2016

There is no point in investing in dotnet pack. We are retiring it right after rc in favor of nuget pack

4reactions
dasMullicommented, Apr 18, 2017

@ardalis You could introduce an msbuild property for your build number as such:

  <PropertyGroup>
    <BuildNumber Condition=" '$(BuildNumber)' == '' ">0</BuildNumber>
    <Version>1.2.$(BuildNumber)</Version>
  </PropertyGroup>
$ dotnet pack /p:BuildNumber=34
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.

  foo -> /Users/martin/foo/bin/Debug/netstandard1.4/foo.dll
  Successfully created package '/Users/martin/foo/bin/Debug/foo.1.2.34.nupkg'.
Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet pack command - .NET CLI
The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a...
Read more >
Producing Multiple Related NuGet Packages from a Single ...
Just create a couple of class libraries, add project references between them, and when you run dotnet pack , it just does the...
Read more >
'dotnet pack' uses Release configuration - .NET
NET 8 SDK or a later version, dotnet pack uses the Release configuration by default for all projects. If you have a CI/CD...
Read more >
Setting up a build with NUKE
Let's take a look at NUKE, a cross-platform build automation system with C# DSL. We'll use it to define the build for a...
Read more >
Using Azure Pipelines to publish the NuGet package from ...
NET Core CLI to pack the code into a NuGet package, then publish it to a folder for the release. Packing the package....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found