I wrote a WinForms C# app that needs administrator privileges to work and also needs to start at computer startup (with registry).
RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
reg.SetValue("My app", Application.ExecutablePath.ToString());
So I tried changing the manifest to requiredAdministrator
and got an error about clickOnce, which I completely didn't understand. So I tried publishing the app and installing as administrator, but then when the application starts at startup it doesn't have the administrator privileges anymore.
Anyone knows how to get administrator privileges for good?