Visual Studio 2017 – SSDT – F5 to execute query

SSDT re-map “F5” to Execute Query, not to compile to project!

I’ve been an advocate of using SQL Server Management Studio (SSMS) to manage procedures, views, functions, triggers and other SQL server objects.

Primarily because it was the right tool for the job and secondly because we have always been able to integrate with source control using the MSSCCI provider downloadable for the version of VS

However since VS 2017 Microsoft have decided to deprecate MSSCCI and push people to use the SSDT shell instance of VS

They have even gone as far as deprecating the “Query Designer” toolbar in VS

So, now when you are editing a stored procedure or function and want to execute it against the database, you have to use the mouse to perform many operations before you can finally execute it

I’ve accepted the push from SSMS to VS SSDT however, I tweaked my install. I prefer to use the F5 key to run my T-SQL against my connection. Believe it or not, this greatly improves the experience of using VS over SSMS

Here’s How

What we are going to do is create two re-maps, that will only apply when you are editing t-sql scripts

1. In your Visual Studio 2017 SSDT shell instance, goto tools > options > Environment > Keyboard

2. In the show command containing type “execute”

3. select the item “SQL.TSqlEditorExecuteQuery”

Now we create the two maps

4a. From the “use new shortcut in” select “Microsoft SQL Server Data tools, T-SQL Editor”

in the “press shortcut key” press F5, then click assign

4b. From the “use new shortcut in” select “Microsoft SQL Server Data tools, T-SQL PDW Editor”

in the “press shortcut key” press F5, then click assign

Note that the Debug.Start(F5 (Global)) mapping will not be affected

Lastly, I prefer that “Ctrl-N” opens a new query window ready to execute against my DB

Add another mapping for this action “Tools.TSqlEditorNewQueryConnection”

Now you can test to see if this has worked. Note that Ctrl-N will only operate from an existing open .sql file

Open a .sql file and hit F5, if you are not already connected, you should see the connection prompt

SSDT for VS2017 – unattended install

download the install bootstrapper from Microsoft

create an offline install layout (optional)

Now that is complete, you can run the install manually or unattended

You must make a decision at this point. If you develop in Visual Studio, and you need to create installer projects as well as SSRS and SSIS projects, then you must install SSDT to a separate instance of Visual Studio. This requires the use of the installer flag “INSTALLVSSQL”, this tells the installer to create a separate instance of visual studio during installation
To view the options run c:\vs2017SSDT>SSDT-Setup-ENU /?

To kick the installer off unattended, you can either use /passive or /quiet