在WPF应用程序的UI中显示TFS服务器内部版本号 [英] Display the TFS server Build number in the UI of a WPF application

查看:88
本文介绍了在WPF应用程序的UI中显示TFS服务器内部版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我查看TFS服务器的界面,在 build& release类别下,我可以看到内部版本号:





我想知道如何获取上次构建的值: 23112017-8 我的WPF应用程序(我想在我的WPF应用程序中显示-上次构建:23112017-8 )。例如,在我的视图模型中,如何通过C#代码获得该值?

解决方案

尝试一下:

 字符串版本= Assembly.GetExecutingAssembly()。GetName()。Version.ToString(); 
this.Text = String.Format( Last Build:-version {0},version);

Assembly.GetExecutingAssembly()。GetName()。Version返回的值是项目的 AssemblyInfo.cs 文件中的内容:

  [assembly:AssemblyVersion( 1.0.0.0)] 

您可以使用扩展名


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

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?

解决方案

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 :

这篇关于在WPF应用程序的UI中显示TFS服务器内部版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆