Determine the version of my Silverlight app

不打扰是莪最后的温柔 提交于 2019-12-10 15:53:00

问题


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!).


回答1:


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, divided by two.

There's a potential bug in VS2010 that affects this. See connect.microsoft.comfor details. -- BillVo



来源:https://stackoverflow.com/questions/1226232/determine-the-version-of-my-silverlight-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!