views:

370

answers:

1

I'm trying to determine the version number of my Silverlight application. Currently I am using:

        string name = Assembly.GetExecutingAssembly().FullName;
        AssemblyName asmName = new AssemblyName(name);

        // http://www.dotnet247.com/247reference/msgs/45/225355.aspx
        string versionNo = "Version: " + asmName.Version.Major + "." + asmName.Version.Minor + "." + asmName.Version.Build + "." + asmName.Version.Revision;

However, four successive builds of my app gives me:

1.0.0.14310

1.0.0.14343

1.0.0.14382

1.0.0.14425

This isn't the end of the world as they are sequential, but I'd like to know how this is being derived. Is the 'current' revision number stored in the project anywhere or will building on another machine break the sequence? It would be great if somebody can point me to some background reading (which isn't MSDN!).

+2  A: 

Take a look in the Assembly.cs file (found in the properties folder of your application.

Note:-

 [assembly: AssemblyVersion("1.0.0.*")]

At the bottom of the file. This specifies a fixed major, minor and build number. The Revision number will be the number of seconds since midnight.

If you had this:-

 [assembly: AssemblyVersion("1.0.*")]

You would get a build number as the number days since Jan 1, 2000 and a revision number as the number of seconds since midnight.

AnthonyWJones