Create service that starts a program during Windows startup in C # WPF

I created a program that needs to be run during Windows startup (before the user logs in). I found an article, they said I should create a service, but don't know how to create a service that starts a program when Windows starts.

Thanks for the help!

+3


source to share


1 answer


Clarification: WPF is a UI tool, not implemented through a service. It is not supported in this usage. You just have to use the key Run

on windows: http://www.windowsdevcenter.com/pub/a/oreilly/windows/ron/startup_0401.html


If you really need a service: Visual Studio has a Windows Service template; New Project => Templates => Visual C # => Windows Desktop => Windows Service. Use it.



Note: you will also need to install the service, and make sure the startup mode is set to "automatic"; there are three ways to do this:

  • installer project
  • installutil

  • or you can do exe self-tuning / un -install, referring to the project from within the assembly and installation causing the installation of the code (I'm trying to use my.exe -i

    and my.exe -u

    to install / uninstall)
+2


source







All Articles