问题描述
如何让一次部署的Click-once应用程序运行启动?
How can I make a Click-once deployed app run a startup?
通过搜索发现的最佳选择是将应用程序上的Publisher设置为Startup,因此开始菜单快捷方式将放置在启动文件夹中,但这似乎是一个巨大的漏洞,我希望人们可以找到一个开始菜单图标。
The best option I found by searching was to set the Publisher on the app to Startup, so the Start menu shortcut would be placed in the Startup folder, but that seems like a huge hack and I would like there to be a Start menu icon people can find.
我有什么选择?
推荐答案
我觉得将应用程序添加到启动文件夹是不专业的。我强烈建议使用启动注册表项来启动您的应用程序。
I feel that adding your application to the startup folder is unprofessional. I strongly recommend using a startup registry key to launch your application.
与本主题的许多材料相反,设置按键以启动一次单击应用程序非常简单,并且不需要设置其他快捷方式。您只需使用在安装时创建的快捷方式:
Contrary to what a lot of the material on this topic says, it is extremely simple to setup a key to launch a click once application and does not require setting up additional shortcuts. You simply use the shortcut created on install:
// The path to the key where Windows looks for startup applications
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
//Path to launch shortcut
string startPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs)
+ @"\YourPublisher\YourSuite\YourProduct.appref-ms";
rkApp.SetValue("YourProduct", startPath);
这篇关于如何在启动时运行一次单击部署的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!