开发者

Application.ProductVersion is not working

Application.ProductVersion开发者_Go百科 is not showing the incremental version. can anybody help me how to perform this, using C# ?


You can have build and revision incremented for you but not major and minor.

Simply substitute

[assembly: AssemblyVersion("1.0.0.0")]

with

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

in the AssemblyInfo.cs


Have you tried grabbing the Assembly's version?

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

Perhaps this is what you are looking for.

Also check out this other SO post - I think this is what you are looking for.

Automatically update version number

Below is a second link to a .Net add-in that automatically increments the:

  • Major
  • Minor
  • Build
  • Revision

http://testdox.wordpress.com/versionupdater/


I have found that it works well to simply display the date of the last build using the following wherever a product version is needed:

System.IO.File.GetLastWriteTime(System.Reflection.Assembly.GetExecutingAssembly().Location).ToString("yyyy.MM.dd.HHMM")

Rather than attempting to get the version from something like the following:

System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
object[] attributes = assembly.GetCustomAttributes(typeof(System.Reflection.AssemblyFileVersionAttribute), false);
object attribute = null;

if (attributes.Length > 0)
{
    attribute = attributes[0] as System.Reflection.AssemblyFileVersionAttribute;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜