How to get app version in Windows Phone?

后端 未结 11 2091
無奈伤痛
無奈伤痛 2020-12-01 13:55

In C# one can use System.Version.Assembly to get the version of a running app. However this doesn\'t appear to exist in Silverlight for Windows Phone. Is there an alternat

相关标签:
11条回答
  • 2020-12-01 14:51
    public static string GetAsemblyVersion()
    {
        return Convert.ToString(Assembly.GetCallingAssembly().GetName().Version);
    }
    
    0 讨论(0)
  • 2020-12-01 14:52

    If you have moved over to Windows Phone 8, you can simply use the newer PackageId class:

    var version = Package.Current.Id.Version;
    
    0 讨论(0)
  • 2020-12-01 14:53

    Windows Phone 8.1:

    using System.Reflection;
    
    // ...
    
    Version version = typeof(MainPage).GetTypeInfo().Assembly.GetName().Version;
    
    0 讨论(0)
  • 2020-12-01 14:54

    You can use the GetExecutingAssembly method and the AssemblyName class to find this information.


      var nameHelper = new AssemblyName(Assembly.GetExecutingAssembly().FullName);
    
      var version = nameHelper.Version;
      var full = nameHelper.FullName;
      var name = nameHelper.Name;
    

    0 讨论(0)
  • 2020-12-01 14:58

    Simply use this line to get the Application Name and Id, publisher name etc...

    string name = Windows.ApplicationModel.Package.Current.DisplayName;
    
    0 讨论(0)
提交回复
热议问题