C# Application (MSIX installation): Startup Task before User Login?

261 Views Asked by At

i have a question regarding auto-start an application:

I have a C# WPF Application, packaged as an MSIX installation. And i successfully setup a StartUp Task via entry in the Manifest. That works fine - after user logs in, the app is started automatically.

But as an additional feature we would need to be able to auto-run the app BEFORE user logs in. After Windows startup, before user login.

Is there a way to do so? I didn't find a solution until now...

Creating a scheduled task for example i found to be not possible, because i can only run a regular .exe file, but no installed application.

Thank you for help!

Best regards Emanuel

2

There are 2 best solutions below

0
Mekroebo On

An easy way for a application to start before the user logs in is to have a Windows Service for it.

If your application does not need any user interaction (and I am assuming it does not because you need it launched before the user logs in) that would be a viable option.

If your application does need user interaction in the Windows Login screen, you will need to do a google search on SysNotify but it is not for the faint hearted :)

0
aemarco On

Still no answer, so at least I´ll let you know a dirty workaround.

I figured that my msix app starts before login, when in Windows Personalization under LockScreen i set that the app should show status info´s on the lockscreen..... so it starts now in the users context, even before login.

under Application I already have the follwing, so the app can be selected to deliver lock screen content. (see 1. link below)

 <uap:VisualElements
    <uap:LockScreen Notification="badgeAndTileText" BadgeLogo="Images\BadgeLogo.png"/>
  </uap:VisualElements>

https://learn.microsoft.com/de-de/previous-versions/windows/apps/hh700416(v=win.10)

Those are the documentation trails might leading to a better solution: https://learn.microsoft.com/en-us/previous-versions/windows/apps/hh781238(v=win.10)?redirectedfrom=MSDN

https://learn.microsoft.com/de-de/previous-versions/windows/dn934782(v=win.10)