Visual Studio Code, a lightweight code editor for developing and debug modern web and cloud applications. This cross-platform development tool can run on – Windows, Linux, and OS X. Both Visual Studio IDE and Visual Studio Code are very powerful editors and almost everyone must be familiar with using these editors. In this post, I will show you how you can open your current project in Visual Studio Code directly from Visual Studio IDE. There could be several reasons to do that, for an instance you have already created a project in Visual Studio or you have currently running a project in Visual Studio but you want to continue writing code with Visual Studio Code Editor. In that case, you need to start the Visual Studio Code instance and open the respective folder. Let’s see how we can achieve directly and apply it for to projects.
We can simply achieve this by adding Visual Studio Code as External Tool in Visual Studio IDE.
Navigate to Tools –> External tools
Click on the “Add” button, and then provide
- Title : Open with Visual Studio Code
- Command : Physical path of your Visual Studio Code Editor
Click on Apply.
Post that if you go back and navigate from Tools menu, you will find “Open with VS Code” option
If you click on the “Open with VS Code” you will find a new Visual Studio Code Editor launched. Great !!
Is that it? I don’t think so. We are yet to achieve something more than just launching the VS Code. Our objective is the open the currently open Visual Studio Project as well.
Well, navigate back to Tools –> External Tools and Select the Open with VS Code option and update following options
- Arguments : . ( Space then dot )
- Initial Directory: $(SolutionDirectory)
Here – We passed the command line arguments for VS Code to open the current directory and we set initial directory as Solution directory
Click on Apply, & that’s it.
Related Tip : Did you Know – You can launch ILDASM Tool from the Visual Studio itself – How ?
Now, If you have any solution open in Visual Studio IDE, and you select the option “Open with VS Code” , you must see the same projects in Visual Studio Code.
Pro Tip : Assigning a shortcut key for faster access
Let’s make it more easy to access by giving it a shortcut key.
Assigning the Keyboard shortcut for external tools are bit tricky, as they are customizable by the end user. So you need to find the position of the external tool in the list of tools that you have and assign the key as appropriate.
In my case, I have it as 3rd external tool. So, navigate to Tools –> Options –> Keyboard.
Search for Tools.ExternalCommand3 ( For you it may differ based on the number of tools you have and its index). and then assign key that suits you and is free, In this case, I have assigned Ctrl+V, Ctrl+O
Now, any time, use this shortcut key to open your current project in Visual Studio Code directly from Visual Studio Editor.
Hope this helps.
There’s also an extension from Mads Kristensen called “Open in Visual Studio Code” that does the same – see https://marketplace.visualstudio.com/items?itemName=MadsKristensen.OpeninVisualStudioCode.
There’s many other “Open In” extensions too from various developers – see https://marketplace.visualstudio.com/search?term=open%20in&target=VS&category=Tools&cost=free&vsVersion=vs15&subCategory=All&sortBy=Relevance.
Pingback: Dew Drop - January 4, 2018 (#2636) - Morning Dew
Thanks Greg for sharing this. I wasn’t aware of this extension. This looks great..
Pingback: Szumma #090 – 2018 1. hét | d/fuel