Solved

Using auto-increment version

Posted on 2008-10-27
9
2,625 Views
Last Modified: 2012-05-05
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
Comment
Question by:rpkhare
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 22810636
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
 
LVL 8

Author Comment

by:rpkhare
ID: 22810650
How to make sure that it is incrementing. Sorry I missed the image in my original post. Attached below.
publish.JPG
0
 
LVL 16

Assisted Solution

by:ororiole
ororiole earned 50 total points
ID: 22810667
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 8

Author Comment

by:rpkhare
ID: 22810685
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
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 22810748
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
 
LVL 8

Author Comment

by:rpkhare
ID: 22810756
Why the Application version is not available in my purchased copy of Visual Studio Professional 2005?
0
 
LVL 47

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 50 total points
ID: 22810780
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
 
LVL 53

Accepted Solution

by:
Dhaest earned 150 total points
ID: 22810858
0
 
LVL 8

Author Comment

by:rpkhare
ID: 22810866
Thanks all.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question