There are several instances where either your build or deployment process relies on services to be running. In these cases, you should ensure that the services are installed and started before they are needed. It’s very easy to start and stop services from MSBuild.
You can use the Exec command to execute the command
net start or