Winforms Desktop Bridge - Launch at Startup

Desktop Bridge makes the Winform app UWP-like - for installation, updates and so on.
See my previous post on how to deploy a Winform App to the Microsoft Store.

source: https://techcommunity.microsoft.com/t5/windows-dev-appconsult/supporting-8220-launch-at-startup-8221-in-a-desktop-app/ba-p/316658


It is not possible to use our standard methods to get Desktop Bride App to launch on startup.
To achieve this, we will need to edit the Package.appxmanifest

Add this line in the <Package tag:
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
Then add the following (modify for your app) in the <Application tag:
<Extensions>
  <desktop:Extension
    Category="windows.startupTask"
    Executable="MyGreatApp\MyGreatApp.exe"
    EntryPoint="Windows.FullTrustApplication">
    <desktop:StartupTask
      TaskId="MyGreatAppTask"
      Enabled="true"
      DisplayName="My Great App" />
  </desktop:Extension>
</Extensions>

That should be it!
Your app should now launch on startup.




Do it incorrectly, and you may get errors like these:
0x80080204 - The specified package format is not valid: The package manifest is not valid.
Manifest validation error: Line 26, Column 59, Reason: The file name "MyGreatApp.exe" declared for element "*[local-name()='Applications']/*[local-name()='Application']/*[local-name()='Extensions']/*[local-name()='Extension' and not(@Category='windows.backgroundTasks' or @Category='windows.appService')]" doesn't exist in the package.
Package creation failed.
Manifest validation error: Line 26, Column 59, Reason: The file name "MyGreatApp.exe" declared for element "*[local-name()='Applications']/*[local-name()='Application']/*[local-name()='Extensions']/*[local-name()='Extension' and @Category='windows.startupTask']" doesn't exist in the package.


Comments