After you’ve installed a UWP application, you may want to know where it got installed to. Maybe there’s a deployment bug that you’re trying to resolve. Maybe it’s just because you’re curious.
Programmatically, your application can ask for the Windows.ApplicationModel.Package.Current.InstalledLocation.Path.
From PowerShell, you can say
Get-AppxPackage -Name YourPackageName
and it will print various tidbits about your package, including its InstallLocation.
Bonus chatter: If you are retrieving the path programmatically because you want to reference content from it, you don’t need to get the path. You can use the ms-appx protocol to access your packaged content. For example
ms-appx:///Relative/Path/To/Content.jpg
references the specified a file relative to your install directory. Some components will accept a URI directly, such as BitmapImage.UriSource. If you need to convert it to a StorageFile, you can use StorageFile.GetFileFromApplicationUriAsync.
0 comments