问题
Using VS2017 latest version 15.9.5 I successfully deployed this UWP Package sample (using their C# folder) from Microsoft's GitHub site on my Windows 10 Pro ver 1809 laptop. But on the sample app's main window (shown below), when I click 1) Identity --> Get Package it doesn't seem to show the package identity.
Question: What I may be missing or misunderstanding here?
NOTE: According to the above mentioned Microsoft article:
Each package is defined by a globally unique identifier known as the package identity. The sample covers following key tasks:
- Getting the package identity using Package.Id
- Getting the package directory using Package.InstalledLocation
- etc. etc.
Sample app's main window when I run the sample:
回答1:
The PackageId
(see Docs) is not a simple string, but instead a full class having several properties which give you access to individual components which together make up the application's unique ID.
The most interesting for you might be FullName
, which is the full unique identifier of the specific version of your package, and FamilyName
which is a version-agnostic identifier of your app.
The PackageId
instance is accessible from Package.Current.Id
.
However, if you want to generate a link to your app in the Store, you must instead hardcode the special Store ID which is generated for you in the Dev Center. You can find details for this here in Docs.
来源:https://stackoverflow.com/questions/54384417/uwp-app-package-information-sample-app-where-it-is-showing-package-identity