Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2647
  • Last Modified:

Using auto-increment version

In my project settings I have enabled "Automatically increment version revision" (See the attached image). I want to know how to display the latest version information on my Form's caption. Where this automatically revised version details are stored and how to use them?
0
rpkhare
Asked:
rpkhare
  • 4
  • 2
  • 2
  • +1
3 Solutions
 
DhaestCommented:
This C# code snippet displays the version number of the specified component.


using System;
using System.Reflection;
 
public class VersionNumber
{
   public static void Main()
   {
      Type type = Type.GetType ("System.Int32");
      Assembly assembly = Assembly.GetAssembly (type);
      AssemblyName assemblyName = assembly.GetName();
      Version version = assemblyName.Version;
      Console.WriteLine ("Version: {0}", version);
      Console.WriteLine ("Major: {0}", version.Major);
      Console.WriteLine ("Minor: {0}", version.Minor);
      Console.WriteLine ("Build: {0}", version.Build);
      Console.WriteLine ("Revision: {0}", version.Revision);
      Console.Read();
   }
}

Open in new window

0
 
rpkhareAuthor Commented:
How to make sure that it is incrementing. Sorry I missed the image in my original post. Attached below.
publish.JPG
0
 
ororioleCommented:
You can also get the assembly version this way, for example putting it in a textbox.
textBox2.Text = Application.ProductVersion;

It is only incremented when you publish your application. It will not should an increment with each build.
It will show up in the publish tab as you have displayed. You can also look in your Properties folder, AssemblyInfo.cs
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
rpkhareAuthor Commented:
But it is a Windows based desktop application. What will Publish do and where it will Publish my application. I want it to be increment on each successful build.
0
 
Wayne Taylor (webtubbs)Commented:
Hi rpkhare,

The version you're showing here is the Publish version, not the application version. The Publish version let's the application know when a new update is available.

See here for more info on the Publish Version and ClickOnce....

http://msdn.microsoft.com/en-us/library/e6y518tc.aspx
http://msdn.microsoft.com/en-us/library/142dbbz4.aspx

Regards,

Wayne
0
 
rpkhareAuthor Commented:
Why the Application version is not available in my purchased copy of Visual Studio Professional 2005?
0
 
Wayne Taylor (webtubbs)Commented:
It is available. In the Application tab of your projects properties, click "Assembly Information" and enter your File version here. Then you can access it as ororiole stated in http:#a22810667

Wayne
0
 
rpkhareAuthor Commented:
Thanks all.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now