Retrieve the Current App version from Package

前端 未结 1 1962
慢半拍i
慢半拍i 2020-12-14 14:38

While I can get the assembly version using the following code

        var assembly = typeof(App).GetTypeInfo().Assembly;
        var assemblyVersion = assemb         


        
相关标签:
1条回答
  • 2020-12-14 15:07

    Here's what you can do to retrieve the version in code:

    using Windows.ApplicationModel;
    
    public static string GetAppVersion()
    {
      Package package = Package.Current;
      PackageId packageId = package.Id;
      PackageVersion version = packageId.Version;
    
      return string.Format("{0}.{1}.{2}.{3}", version.Major, version.Minor, version.Build, version.Revision);
    }
    

    Reference: http://www.michielpost.nl/PostDetail_67.aspx

    0 讨论(0)
提交回复
热议问题