How to remove the custom path while uninstalling MSIX package ?

Copper Contributor

After installed the msix package, the application creates some folder and files in different locations, how to remove those path while uninstallation ?

5 Replies
Can you be more specific about the location of those files that you are concerned about? If you have an idea on how the app put them there, it might help also.

@TIMOTHY MANGAN 

Thanks for your response.

Yes, the folder creating under C:\ProgramData folder and its creating by C++ applications.

MSIX does not have a method to remove files written to those locations. However, by adding the PSF (PsfLauncher.exe to front the application, plus PsfRuntime.dll and either FileRedirectionFixup or MfrFixup), you can cause those writes to be redirected to the user's local appdata\Packages redirection area for the package. The redirected location is removed by default when the package is uninstalled, which would be a solution.

@TIMOTHY MANGAN , Thank you so much, your suggested solution should work.

Our scenario is little different, we are creating folder\<files> under C:\ProgramData\.. due to easy access by the other applications as well, so we have to clean it only when uninstall this MSIX application.

 

I have gone through the below information, kind of this, is possible in MSIX? 

Here, this "Setup_AntiCheat.bat" contains the info what to delete during uninstall. 

<Extensions>

 <desktop6:UninstallActions>

<desktop6:UninstallAction File="Setup_AntiCheat.bat" Name="AC_1" Arguments="/remove /silent" /> </desktop6:UninstallActions>

</Extensions>

Ref: https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-desktop6-install...

 Note: This element is currently intended to be used only by desktop PC games that are packaged in an MSIXVC container. It requires the customInstallActions restricted capability.

 

[Intent is to execute the .exe or .bat during MSIX uninstallation. Note: I have tried PowerShell script, but our clients may not be having permission to run PowerShell script.]

 

Thank you so much for your prompt response.

 

@DhanarajG I may not be much help then, as I don't use that extension. 

 

But if your package does not also use the install option, then you may have hit something basic, such as this could be something basic like the custom action and/or MinVersion/MaxTestedVersion in the AppXManifest not being high enough.