MicrosoftDocs / msix-docs

repository for msix content
Creative Commons Attribution 4.0 International
60 stars 114 forks source link

What should be passed as the volume? #254

Closed yowl closed 3 years ago

yowl commented 3 years ago

The example is nice, but its not clear what to pass as the volume, could that be explained here?

i.e. here:

public async void CheckForAppInstallerUpdatesAndLaunchAsync(string targetPackageFullName, PackageVolume packageVolume)

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

anarvekar-msft commented 3 years ago

Thank you for your question @yowl . PackageVolume is this: https://docs.microsoft.com/en-us/uwp/api/Windows.Management.Deployment.PackageVolume?view=winrt-20348

It's basically C: or D:, whichever drive the package was installed to.

yowl commented 3 years ago

Thanks, when requesting an update, does it have to be the same as where the package was installed originally, or can it be new PackageManager().GetDefaultPackageVolume() ?

Or maybe the better question is , how do you get the PackageVolume or volumeName for a package as PackageVolume has no public constructor?

anarvekar-msft commented 3 years ago

@yowl It has to be the same as where the package was installed originally. To find the PackageVolume you can use FindPackageVolumes. It returns a list of PackageVolumes and you can pass the one you want to the method.

https://docs.microsoft.com/en-us/uwp/api/windows.management.deployment.packagemanager.findpackagevolumes?view=winrt-20348

You only need to do this for the first time install. If you're doing an update, you can just pass in null for packageVolume parameter and skip that step

yowl commented 3 years ago

`

You only need to do this for the first time install. If you're doing an update, you can just pass in null for packageVolume parameter and skip that step `

Ah, thanks a lot, that is what I needed to know.