I'm using the following code to set an Autostart of my Application:

using (RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
{
           rk.SetValue("Application", Application.ExecutablePath); //add autostart
}

When i compile it my Windows Defender instantly deletes the File because it found "Trojan:Win32/Bearfoos.A!ml" and "Trojan:Win32/Azden.A!cl"
What could i change, because my solution is a common solution?

1 Answers

0
VollRahm On

I got it. Apparently you can't have this in the Form constructor, you need to edit the Registry AFTER the Form_Shown() Method otherwise Windows Defender get's you. I can't undertsand the logic behind this :thinking: