Open Any Folder with Visual Studio “15” Preview

For developers to be truly productive in Visual Studio their code needs to be organized into Solutions and projects, right?

For a long time, that was a core expectation of how Visual Studio works. Unfortunately, this requirement is a bit of a burden for those of you working across multiple tools and platforms. Sometimes Solutions make a lot of sense, sometimes they don’t – even for languages that Visual Studio has great support for. Many developers start a project by searching GitHub to see what problems other developers have already solved that might be similar to the new project they’re working on. Unfortunately, since most of these projects lack a Solution file, onboarding them into Visual Studio is tedious.

For these developers, we are introducing a new way to work with code in Visual Studio. Visual Studio “15” Preview can open any folder and:

  • Edit code.
  • Navigate to symbols.
  • Build.
  • Debug and place breakpoints.

All of this works without any projects or Solutions.

With Visual Studio “15” Preview, you can now clone any of these repos and open the folder directly. This means that you won’t have to spend time creating a new Solution or project file. This in turn ensures that you will be able to launch more quickly into solving your coding problem.

This new capability to open a folder that has an unknown or missing Solution or project file also comes with the following support features:

  • Most popular languages will have Syntax Highlighting and navigation:

Syntax Highlighting And Navigation

  • Many languages can be debugged as well. Node.js, Python, C#, C++, and VB in the Preview, more coming soon.
  • Git version control is integrated with open folders.

There are two ways to open a folder in Visual Studio. In the Windows Explorer context menu on any folder, you can click “Open in Visual Studio”. Or on the File menu, click Open, and then click Folder. Recent folders will be persisted to the MRU.

Open From Windows Explorer Or File Menu

Debugging

No Visual Studio feature would be complete without a robust debugging experience. Visual Studio “15” Preview supports debugging Node.js, Python, MSBuild based project (C#, C++, VB), and any executable with PDBs.

Node.js and Python

  1. Install Node.js or Python Tools or Visual Studio “15” Preview and the Node.js runtime.
  2. Right-click any JavaScript file in the Solution Explorer, and then click “Set as Startup Item.”
  3. Press F5*.

Solution Explorer Right Click Set Up As Startup Item

* For Python, there is an additional step. Click the debug dropdown, and then select “Customize” and add the following property to the file’s launch configuration. Now you are ready to F5. This extra step will be removed in a future release.
“pythonInterpreter”: “c:\\{Path To Python}\\python.exe”

Add property Python Interpreter

MSBuild Projects

  1. In the debug dropdown menu, select the project (or select the project or file that you want to display as the “Startup Item” in the Solution Explorer).
  2. Press F5.

Executables

  1. Select the EXE as the “Startup Item” in the Solution Explorer.
  2. Verify that the PDBs next to the EXE are up to date.
  3. Press F5.

Debugging the Current Document

  1. If you have selected “Current Document” in the debug dropdown, Visual Studio will attempt to debug the current document (for example a script) or the project that it belongs to.
  2. If the current document cannot be debugged, Visual Studio will ask you to select a startup item manually through the Solution Explorer context menu.
  3. This is the default selection in the debug dropdown menu.

Customizing F5

You can customize F5 as well, for instance, passing command line arguments to the debugger process. More customization will be available in future releases.

Command Line Arguments

In the debug dropdown, click “Customize” and add the following property to the file’s launch configuration:
“args”: [“arg1”, “arg2”]

Command Line Arguments

Summary

With Visual Studio “15” Preview, we’ve worked hard to simplify the basics and make it easier for you to launch into the fun stuff. The open folder feature will save you time and headaches in trying to assess whether a repo gets you 80% there or has already solved the problem for you. This feature is also fully extensible. More details and documentation about the features extensibility will be available soon.

There are a few things to keep in mind though. This is a preview release, so the feature still has a few rough edges. The configuration syntax, especially in launch.json, is likely to change in future releases of Visual Studio.

Will Buik – Program Manager, Visual Studio IDE Project and Build

Will is a long time user of Visual Studio. Since his foray into programing with Visual Basic 4, he has loved programming, software development, and hardware hacking.  He loves working on the development tools that he has leveraged for many years.