Not a problem.
Now about your last bit.
You wrote "Project_AfterInstall event, trying to edit the config file in the destination folder before installing the Windows Service". You probably already see the problem with this statement :)
You are trying to do some "before-install" activity but at the "after-install" stage.
The
Of course there can be a service that starts with any config file and it can simply monitor this file for any changes. And then updates itself when the change is detected. Though most likely your service is an ordinary service that doesn't do that. Thus you will need to delay the start of your service by not setting StartOn. And after you changed your config you can start your service from the AfterInstall event handler with something like this:
Now about your last bit.
You wrote "Project_AfterInstall event, trying to edit the config file in the destination folder before installing the Windows Service". You probably already see the problem with this statement :)
You are trying to do some "before-install" activity but at the "after-install" stage.
The
Project_AfterInstall
is in fact a correct place to to do the config file modifications. However at that time your service will be already installed and attempted to start with the original unmodified config file. This is because you set StartOn = SvcEvent.Install
. Of course there can be a service that starts with any config file and it can simply monitor this file for any changes. And then updates itself when the change is detected. Though most likely your service is an ordinary service that doesn't do that. Thus you will need to delay the start of your service by not setting StartOn. And after you changed your config you can start your service from the AfterInstall event handler with something like this:
Process.Start("net", "start ConvertCommandCenter");