Search code examples
uwpexedesktop-bridge

UWP (Desktop Bridge) App and User Downloadable Executables


We are currently in the process of converting our application to UWP (Via DesktopBridge) and have so far had no issues, however we support custom executables that users can create to extend the functionality. These download ok from within the application, but when we attempt to execute them we get an LP5 error.

Because of the nature of these files we cannot add them to the appxmanifest or download them as ExtensionPacks from the AppStore.

Is there a workaround for this that we can use? or has anyone found a solution that could come in handy

As usual any help is greatly appreciated. Thanks


Solution

  • When your app writes files (content or executables) to the AppData folder, those writes will be redirected to a per-app/per-user location under %userprofile\AppData\Local\Packages{PackageFamilyName}. This is documented here:

    https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-behind-the-scenes

    You have a couple of option to accomplish this scenario in your app:

    1) ShellExecute your files from the redirected location

    2) Use the modern ApplicationData API for both read and write and you won't need to know about the actual location: https://learn.microsoft.com/en-us/uwp/api/Windows.Storage.ApplicationData

    3) Use a different location that is not redirected, such as %temp%

    One general note on your scenario: executing dynamically downloaded binaries is not supported on devices in Win10S Mode. Only store-signed code can be executed on those.