Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

Publish image from VS2012

NEW IMAGE:

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
188 views
Welcome To Ask or Share your Answers For Others

1 Answer

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));
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...