获取应用程序版本Windows Phone 8

Ard*_*ori 8 windows-phone-8

我正在关注MSDN上的示例代码(http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.package.id.aspx)以获取C#中的当前应用程序版本

 string buildVersion = Package.Current.Id.Version.Build.ToString();
Run Code Online (Sandbox Code Playgroud)

但它给了我以下错误:

'Windows.ApplicationModel.Package.Current.Id' threw an exception of type 'System.NotImplementedException'
Run Code Online (Sandbox Code Playgroud)

有谁知道我怎么能得到应用程序的版本号?

Pau*_*tts 4

该 API 不可用:如果您仔细查看 MSDN,您会发现这会引发 WP8 的异常。您必须使用与 WP7.x 相同的技术。

即:

  1. 在清单中查找版本号。
  2. 查找程序集的版本。
  3. 连接您自己的内部版本号。

请参阅/sf/answers/397647561/WP7 - 从代码中获取编译/构建日期?