I’d like to have a script that stops a certain windows service,build or rebuild a solution and runs the service after the build process finished.
Should I use Msbuild for this ? Or is there any other way ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use a batch file that will stop the service, build the solution then start the service:
See how to start/stop services from the command line, and the msbuild command line reference.
Your other option, as mentioned is to use the MSBuild community tasks. There are many of them – ServiceController is the specific one for your need.