在WPF应用程序的UI中显示TFS服务器内部版本号 [英] Display the TFS server Build number in the UI of a WPF application
问题描述
如果我查看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 :
- How to display the running version in a C# WPF app
- How can I display the Build number and/or DateTime of last build in my app?
这篇关于在WPF应用程序的UI中显示TFS服务器内部版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!