Display the TFS server Build number in the UI of a

2019-08-27 16:08发布

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?

标签: c# wpf tfs build
1条回答
Anthone
2楼-- · 2019-08-27 16:47

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

查看更多
登录 后发表回答