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.

Version with build number (TFS or VSTS)

See original GitHub issue

This is more a question than an issue.

Any hints on how to update the version number to use the build number from TFS or VSTS? Previously I used a powershell script that was run prior to the build step that changed the version number in the assembly information, but now the version is contained in the project json file this script is useless.

Must also include 3 numbers in the version now and star the last (4.6.2.-*) where --version-suffix will change the last part. This means I can’t insert the build number (4.6.16334,03) which represents the major, minor, day and build instance for the day. This format is very important to us and the way we use CI.

Environment data

dotnet --info output: .NET Command Line Tools (1.0.0-preview2-003131)

Product Information: Version: 1.0.0-preview2-003131 Commit SHA-1 hash: 635cf40e58

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

9reactions
dasMullicommented, Mar 24, 2017

btw… with csproj tooling you can also define a completely custom properties to use during build. e.g.:

<PropertyGroup>
  <Day Condition=" '$(Day)' == '' ">0</Day>
  <BuildNumber Condition=" '$(BuildNumber)' == '' ">0</BuildNumber>
  <VersionPrefix>4.6.$(Day).$(BuildNumber)</VersionPrefix>
</PropertyGroup>

which could be used from CI using:

dotnet msbuild /t:Restore;Pack /p:Configuration=Release /p:Day=123 /p:BuildNumber=3

(note that the restore is necessary because of https://github.com/NuGet/Home/issues/4337) This may solve @Allann’s original issue.

2reactions
dasMullicommented, Jan 5, 2018

E.g. via

var version = Assembly.GetEntryAssembly()
    .GetCustomAttribute<AssemblyInformationalVersionAttribute>()
    .InformationalVersion;

or typeof(MyClass).Assembly.…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Version with build number (TFS or VSTS) #7263 - dotnet/sdk
This is more a question than an issue. Any hints on how to update the version number to use the build number from...
Read more >
Build Versioning
The VSTS / TFS build agent checks out the commit directly since the branch pointer can move between build queue time and build...
Read more >
VSTS issue with applying Build Version Number to the ...
I have an issue with applying Build Version to my assemblies in the VSTS Pipeline. In the past this was achieved was using...
Read more >
Run (build) number - Azure Pipelines
In Azure DevOps $(Rev:r) is a special variable format that only works in the build number field. When a build is completed, if...
Read more >
Build versions and packaging in Azure DevOps
A guide to build version numbers in Azure DevOps, and how they work with ... Microsoft has renamed Visual Studio Team Foundation Server...
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