在Windows Phone 8中如何获得各种版本号

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/coaxhappy/article/details/8818423

1、在WP8中获得应用程序集(Assembly Version)版本号:

     Assembly .GetExecutingAssembly().FullName="PhoneApp1, Version=1.0.0.1, Culture=neutral, PublicKeyToken=null"

     在此字符串中截取即可。

2、在WP8中获得应用程序文件版本号(File Version)版本号:

     CustomAttributeData customAttributeData = Assembly.GetExecutingAssembly().CustomAttributes.FirstOrDefault(ele => ele.AttributeType == typeof (System.Reflection.AssemblyFileVersionAttribute));

     if (customAttributeData != null)

     {

          tbVersion.Text = customAttributeData.ConstructorArguments[0].Value.ToString();

     }

3、在WP8中获得应用程序包版本号(Packaging)版本号,此版本号在提交应用商店时有效。

扫描二维码关注公众号,回复: 5564432 查看本文章

     string version = XDocument.Load("WMAppManifest.xml" ).Root.Element("App").Attribute( "Version").Value;

猜你喜欢

转载自blog.csdn.net/coaxhappy/article/details/8818423