A Microsoft platform for building and publishing apps for Windows devices.
Hello @Diogo Costa Maranhao Rodrigues ,
From my research, I see the issue is rooted in Windows platform behavior, not a defect.
Optional packages have an independent package identity and lifecycle from the main app. A reset through App Settings only clears the main package's application data; it does not remove optional packages, which the platform treats as separate installed packages.
The reason why the symptom may occur:
-
Get-AppxPackagedoes not return optional packages without-PackageTypeFilter Optional. - Optional packages do not appear in the App Settings reset scope; they are managed separately.
- Packages reappearing after removal strongly suggests the wrong API is being used.
Remove-AppxPackageandRemovePackageAsyncare not the correct surface for optional packages.
I recommend using PackageCatalog:
using Windows.ApplicationModel;
using Windows.Management.Deployment;
PackageCatalog catalog = PackageCatalog.OpenForCurrentPackage();
PackageManager pm = new PackageManager();
var optionalFullNames = pm
.FindPackagesWithPackageTypes(PackageTypes.Optional)
.Where(p => p.Id.FamilyName == Package.Current.Id.FamilyName)
.Select(p => p.Id.FullName)
.ToList();
var result = await catalog.RemoveOptionalPackagesAsync(optionalFullNames);
if (result.ExtendedError != null)
throw result.ExtendedError;
Two caveats to check before calling this:
- If your optional packages are related set packages (contain executable code), the platform requires an app restart to finalize removal. You must notify the user before calling the API.
- If they are content-only packages, mark the content as not in use by the app first. This avoids conflicts and removes the restart requirement.
The scope filter on FamilyName is critical. Without it, FindPackagesWithPackageTypes returns all optional packages on the system, including system components and other apps.
Users can manually remove individual optional packages via Settings > Apps > [Your App] > Advanced options.
Hope this helps! If my explanation and the information I provided were helpful, I would greatly appreciate it if you could follow the instructions here so others with the same problem can benefit as well.