我已经创建了一个 ClickOnce 应用程序,可以离线使用并且可以通过开始菜单访问。
但是,是否可以通过代码或设置将此应用程序设置为在启动时启动/在启动文件夹中设置快捷方式,而不是创建某种批处理文件来为我执行此操作? ClickOnce 选项似乎真的很有限!
最佳答案
您可以在这里找到问题的答案,Run ClickOnce app on startup
您还可以使用启动注册表项来启动您的应用程序。
设置启动 ClickOnce 应用程序的键非常简单,不需要设置额外的快捷方式。您只需使用安装时创建的快捷方式:
// The path to the key where Windows looks for startup applications
RegistryKey rk = Registry.CurrentUser.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
//Path to launch shortcut
string startPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs)
+ @"\YourPublisher\YourSuite\YourProduct";
rk.SetValue("YourProduct", startPath);
关于c# - 使用 ClickOnce 应用程序创建启动文件夹快捷方式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13305517/