I have a service coded in c# .NET 3.5 being installed using a Visual Studio 2010 installer. I need the service to be set up as Automatic Delayed start. I have found some articles which tell me to set the Service to Automatic, and then add a DWORD to the Registry at HKLM\System\CurrentControlSet\Services\theservice
. The problem is that I'm not quite sure how to add the Registry key using my installer.
One site I visited suggested this script:
Set-ItemProperty -Path "Registry::HKLM\System\CurrentControlSet\Services\theservice" -Name "DelayedAutostart" -Value 1 -Type DWORD
However, I don't see a way to add a post-install event to the installer. Microsoft and jdknight (bottom post) both suggest running a AfterInstall Event, but again I am not quite sure how to incorporate it with the Visual Studio installer.
Any help would be greatly appreciated.
Can't you just the setup project's Registry view to add whatever key and data you need?
Note that you can Right-click HKEY_LOCAL_MACHINE, then New key, then add SYSTEM, and proceed to add other folders like CurrentControlSet.