确定我的 Silverlight 应用程序的版本 [英] Determine the version of my Silverlight app

查看:29
本文介绍了确定我的 Silverlight 应用程序的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试确定我的 Silverlight 应用程序的版本号.目前我正在使用:

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.14310

1.0.0.14343

1.0.0.14343

1.0.0.14382

1.0.0.14382

1.0.0.14425

1.0.0.14425

这不是世界末日,因为它们是连续的,但我想知道这是如何推导出来的.当前"版本号是存储在项目中的任何地方还是在另一台机器上构建会破坏序列?如果有人能指点我一些背景阅读(这不是 MSDN!),那就太好了.

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

推荐答案

查看 Assembly.cs 文件(位于应用程序的属性文件夹中.

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

注意:-

 [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.

如果你有这个:-

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

你会得到一个内部版本号作为自 2000 年 1 月 1 日以来的天数和一个修订号作为自午夜以来的秒数,除以二.

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.

VS2010 中存在影响此功能的潜在错误.有关详细信息,请参阅 connect.microsoft.com.-- 比尔沃

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

这篇关于确定我的 Silverlight 应用程序的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆