Search code examples
installationwindows-store-appsuwpappx

Un-install win32 application while installing appx


I have installed an appx in my machine (helloworld.appx) which has the executable file Helloworld.exe. I have already installed the same executable file helloworld.exe as win32 application. Is it possible to remove installed win32 application during appx installation? If it is possible how can we achieve this?


Solution

  • You cannot. The appx installation process does not allow you to perform any custom action.

    The appx application itself is not allowed to do it since it cannot leave its sandbox and alter the filesystem.

    The only thing you can do is to launch the setting app and let the user do the uninstallation of your Win32 app himself.

    bool result = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:"));
    

    You can get all the links to open the settings app from here.