How to start/stop local SQL Server service directly from Visual Studio?

后端 未结 2 1834
梦如初夏
梦如初夏 2021-01-24 10:28

I believe like many developers I have both Visual Studio and SQL Server installed on my PC. Since I use the PC for various tasks not just for development, SQL Server is by defau

2条回答
  •  抹茶落季
    2021-01-24 11:27

    1. In Visual Studio, go to Tools -> External Tools...

    2. Click the add button, and enter Start SQL Server for the title and for the command put:

      C:\WINDOWS\system32\net.exe

    3. For the arguments, put:

      start mssqlserver

    4. Untick "Close on exit" and tick "Use output window".

    5. Repeat steps 2-4 to create the stop command, but for the arguments put:

      stop mssqlserver

    You know have two external tools configured which you can run by selecting them from the Tools menu in Visual Studio.

    You can also add a shortcut button in any toolbar by right-cliking on the toolbar area, selecting customise, and then dragging the relevant external tool link (unfortunately VS refers to them as this, so you will have to figure out which one to choose) to a toolbar.

提交回复
热议问题