如何显示一个文本框发布的版本? [英] how to show publish version in a textbox?
问题描述
您好再次每一个人,
另外一个有趣的问题。此刻,我每次发布时手动更新我的应用程序的版本字段(文本框)。我想知道如果有一种方法让我的应用程序从什么地方得到的数据,并在框中显示对我来说。我使用VS2012,我只是不确定如何实现,在C#。下面是我讲的是VS2012属性窗口的屏幕截图。
another interesting question. At the moment I am manually updating the version field (textbox) in my application every time I publish it. I am wondering if there is a way to have my application get that data from somewhere and display it in the box for me. I am using VS2012 and I am just unsure of how to achieve that in C#. Below is a screenshot of the VS2012 properties window that I am talking about.
NEW IMAGE:
NEW IMAGE:
推荐答案
不要忘记检查,如果该应用程序,否则networkdeployed将无法正常工作在调试模式下。
Don't forget to check if the application is networkdeployed otherwise it won't work in debug mode.
if (ApplicationDeployment.IsNetworkDeployed)
{
this.Text = string.Format("Your application name - v{0}", ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(4));
}
这篇关于如何显示一个文本框发布的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!