I'm new to MAUI and I'm making an application where I need to make the app run on startup on windows. I did this before on Winform/WPF using things like registry records, adding a shortcut to shell:startup, or even from the installer file (like Inno setup).
Obviously, I can't use anything from above with MAUI as I don't have an EXE file or even able to get the executable directory.
MAUI is still new and there were no useful results when I searched.
Even a script that I can maybe add to a Task Scheduler would be helpful at this point as I can create a task for it but I need to know how to run an app on windows that is installed from the windows store. Thanks.
Edit: Whenever I try to run the EXE file from windows build I get this error from the event viewer
Faulting application name: MAUIApp1.exe, version: 1.0.0.0, time stamp: 0x6331eb0e
Faulting module name: KERNELBASE.dll, version: 10.0.22621.608, time stamp: 0x4769d08d
Exception code: 0xe0434352
Fault offset: 0x000000000008fb0c
Faulting process id: 0x0x5670
Faulting application start time: 0x0x1D8EE46B08192B8
Faulting application path: D:\CrossPlatform\MAUIApp1\MAUIApp1\bin\Debug\net6.0-windows10.0.19041.0\win10-x64\MAUIApp1.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: 395637f8-d737-4ae3-8443-da7889494026
Faulting package full name:
Faulting package-relative application ID:
Thanks to ToolmakerSteve comment I figured out how to make it. I still prefer doing it from the code as it gives me more control, but at least I can make it start with windows now.
I'm leaving the direct solution here for anyone in the future coming to look for it.
Under platform>Windows open Package.appxmanifest with a notepad or any text editor.
Inside Applications, tag add the following code
Should be like this
Enabled="true" make the star on startup enabled by default.
Enabled="false" still add the app to the startup list, but the user needs to go enable it from Task Manager himself/herself.
Next, add this line to the top inside the Package tag
Now save it then start your solution again then run your app or publish it, once the app starts it will be added to the startup list.