Solved

Using auto-increment version

Posted on 2008-10-27
9
2,624 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now