C# 注册表自动启动导致错误“;基础提供程序在打开时失败";
正在将程序添加到注册表:C# 注册表自动启动导致错误“;基础提供程序在打开时失败";,c#,autostart,C#,Autostart,正在将程序添加到注册表: Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\", true); key.SetValue("App", AppDomain.CurrentDomain.BaseDirectory + "App.exe"); key.Close(); Micro
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\", true);
key.SetValue("App", AppDomain.CurrentDomain.BaseDirectory + "App.exe");
key.Close();
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
key.DeleteValue("App", false);
key.Close();
以及从注册表中删除:
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\", true);
key.SetValue("App", AppDomain.CurrentDomain.BaseDirectory + "App.exe");
key.Close();
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
key.DeleteValue("App", false);
key.Close();
启动程序后,如果我不注销并关闭程序,则需要登录或自动登录
因此,问题是:
我该怎么办?你自己的结论可能确实是准确的;这种情况下的解决方案是向应用程序添加代码,等待它所依赖的任何其他服务启动。请查看此搜索,以便开始: