2016-04-23 548 views
0

在嘗試使用下面的行從Package.appxmanifest標識元素讀取Name屬性的值:獲取通用Windows平臺的的AppId(UWP)應用

string PackageName => CurrentApp.AppId.ToString(); 

我得到這個異常:

The thread 0x22cc has exited with code 0 (0x0). 
System.Exception: Exception from HRESULT: 0x803F6107 
    at Windows.ApplicationModel.Store.CurrentApp.get_AppId() 
    at MyApp.UWP.get_PackageName() 

這不是通常的方式來訪問UWP清單中的Identity元素的Name屬性值嗎?

+0

您正在測試哪個版本的Windows?我相信Windows Phone 8.1不支持這一點。 –

+0

在Windows 10上進行測試.Windows phone 81確實對此有效。 – Adam

+0

[如何獲取Windows通用應用程序中的應用程序版本?](http://stackoverflow.com/questions/25144054/how-to-get-app-version-in-windows-universal-app) – Romasz

回答

0

這工作:

string PackageName => Package.Current.Id.Name; 
0

CurrentApp.AppId可用您的應用程序從Windows應用商店部署後才能。

相關問題