0

If I look at the interface of TFS-server, under category "build & release", I can see the build number:

enter image description here

I want to know how can I get access to the value of the last build: 23112017-8 in my WPF application (I want to display in my WPF app - "Last Build: 23112017-8"). How can I get this value via C# code, for example in my view model?

Cod Fish
  • 917
  • 1
  • 8
  • 37

1 Answers1

2

Try this :

string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();  
this.Text = String.Format("Last Build: - version {0}", version);

The value returned from Assembly.GetExecutingAssembly().GetName().Version is that in your project's AssemblyInfo.cs file:

[assembly: AssemblyVersion("1.0.0.0")]

You can use the extension Update AssemblyInfo to modify the version as build number before a build to specify the value it returns.

Just use the predefined variable Build.BuildNumber to get the build number.

Reference :

enter image description here

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55