5

I need to add my application to the startup and hence, need to set the Registry Key with the Installation path. I have got this working through the Visual Studio Setup project but can't figure out how to do it through a ClickOnce deployment.

Anyone know how to set registry keys when using ClickOnce for installation?

bmargulies
  • 97,814
  • 39
  • 186
  • 310
Sanket
  • 463
  • 3
  • 14
  • You could use click once to deliver the installer, then launch the installer when the click once application launches. I'm just guessing here but I think that is how Google Chrome installed in the earlier versions. – Eric Scherrer Nov 17 '20 at 22:26

2 Answers2

6

ClickOnce can't do this. If you want your app to start when the user logs in, you have to write code in your application to do it (copy a shortcut to the startup folder, edit the registry, etc.)

Also, keep in mind that if you write code to handle this scenario, it won't be undone when the user uninstalls your application.

Here is a forum question and blog post that should help you out. And here are similar SO questions, 401816 and 1650650.

Community
  • 1
  • 1
codeConcussion
  • 12,739
  • 8
  • 49
  • 62
  • Thanks whatknott. After some more browsing, I also came to the same conclusion. I now have code written on form load which checks if the app is being run for the first time (based on a value in the settings file) and adds the registry key in case of first run. Also, I am checking whether the registry key already exists since ClickOnce won't delete it on uninstall – Sanket Nov 20 '09 at 16:41
0

You should use Visual studio installer. Earlier VS removed installer project. But now they are offering it with marketplace project for free. https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects It is a suggestion.

Jin Thakur
  • 2,711
  • 18
  • 15