Search code examples
c#windowsuwpwindows-store-apps

How to make a C# Windows Forms app , converted for the Windows Store, start with Windows


I have created a Windows Forms C# app called "Desktop Web Tiles", that creates a panel with four websites that run with Microsoft Edge.

https://www.microsoft.com/en-us/p/desktop-web-tiles/9pmp8f1nqcj7?activetab=pivot:overviewtab

I converted the app with Desktop Bridge for Windows Store and published it. The only problem is I cannot make the Windows Store app run at startup for the end user. Looking around I found this link:

https://blogs.windows.com/windowsdeveloper/2017/08/01/configure-app-start-log/#V6oroyVxClAEehF6.97

It says to use the "windows.startupTask" Extension in my app manifest to make the app autostartup. The problem is I don't know much about handling the app manifest and I am stuck. It is essential for my app to start with windows, because it is fundamental for its usage. I would appreciate your help.


Solution

  • The problem is I don't know much about handling the app manifest and I am stuck.

    If you used Desktop Bridge you will find Package.appxmanifest file where in the Windows Application Packaging Project, Then double click appxmanifest file - > press F7 view code-> Add the following to appxmanifest file.

    xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
    IgnorableNamespaces="uap mp rescap desktop">
    
      ......
    
    <Applications>
      <Application Id="App"
        Executable="$targetnametoken$.exe"
        EntryPoint="$targetentrypoint$">
    
      .....
    
        <Extensions>
          <desktop:Extension
     Category="windows.startupTask"
     Executable="DesktopApp\DesktopApp.exe"
     EntryPoint="Windows.FullTrustApplication">
            <desktop:StartupTask
              TaskId="MyStartupId"
              Enabled="false"
              DisplayName="TestWinFormApp" />
          </desktop:Extension>
        </Extensions>
      </Application>
    </Applications>
    

    Run your app and enable app's startup in the startup list. For detail steps please refer provided blog. For better understanding I share appxmanifest here.