Node.js
is a powerful platform for building all kinds of applications. One caveat with
using different platforms is that some tools
cannot be used for certain technologies. This was true for Node.js and Visual
Studio, but the Node.js Tools for Visual Studio plugin allows you to use a familiar tool to build Node.js
applications.

Node.js
+ Visual Studio

The Node.js
Tools for Visual Studio plugin is freely available online. The current version, which is available for Visual Studio 2012
and 2013, is an alpha release. The plugin provides the following features for building
Node.js applications in Visual Studio.

Node.js project types allow you to build
Node.js console and web applications from scratch and use existing code.
In addition, you can create Express and Azure-hosted applications. Figure A shows
the new project options in Visual Studio 2013; the options appear under the
JavaScript project type.

The plugin provides full Node.js IntelliSense
support, so everything is at your fingertips. Figure B shows it in action with
an application utilizing Express.

The debugging features of Visual Studio are
paired with V8
JavaScript debugger used by Node.js. It shows that
Microsoft did not try to reinvent the wheel with the Node.js debugger feature. As
with any Visual Studio project, hit F5 to start debugging. Figure C shows a
debugging session with a breakpoint set; it supports local and remote
debugging. Figure D shows the Node.js menu added with the plugin — it provides
links to remote debugging documentation. In addition, the Visual Studio code
profiling feature may be used on Node.js projects to better understand code
performance.

There is heavy Azure
integration with Azure-specific project options as shown
in Figure A. There is full support for deploying to Azure by selecting Publish from
the Build menu. Figure E shows an application successfully deployed to Azure.

The plugin brings full npm integration. You can
use the standard command-line interface for managing npm modules as well as
using Visual Studio. Node.js projects have an npm folder that contains
installed modules. You may right-click the npm folder and select Manage npm
Modules to open the npm Package Management window shown in Figure F; this
allows you to work with installed modules as well as adding more. I have used the
search feature to find the ejs template module, which can be installed with the click of a button.

While the
list is not exhaustive, it does show that this is not a trivial plugin — Visual
Studio can be used to build a full-featured Node.js application.

Debugging Node.js code in Visual Studio follows normal path (hit F5).

Node.js Tools for Visual Studio debugging menu options.

You can easily manage npm modules within Visual Studio.

Taking it for a
test drive

I created web and Azure-based applications with only a few clicks. While it is a
standard IDE feature, IntelliSense support with Node.js is great. It may be my
age, but there is just too much for a developer to remember, and switching from
the IDE to a Node.js reference or a quick web search is a distraction that is
best avoided. If you're an Azure customer, the tight integration with it will
be applauded. I built, deployed, and tested a Node.js application on Azure, and the
deployment process could not have been simpler.

The other
approach to building an application is to use existing code; this is supported
by way of a plugin-provided wizard. The wizard holds your hand through
the process of importing an existing Node.js application into a Visual Studio
project. It starts by asking for the path to the current code, and you have the option to exclude specific file types. Next, you specify where the newly created Visual
Studio project should be saved. The final step is to specify what top level
file will run the application via Visual Studio; this can be changed
within the IDE once the project is created.

Building
applications is great, but you usually need to play with code and get a feel for
what certain pieces of code may do. The Node.js Interactive Window provides
everything you need — that is, a console to type and execute code snippets.
You can use the standard command line, but staying within the IDE is nice.
Figure G shows where the option is located within the IDE.

Figure G

The Node.js Interactive Window is a great way to test commands.

Easily build
Node.js applications

Developers used to be in the Microsoft camp or the open source camp, but integrations are blurring those lines, and the Node.js
Tools for Visual Studio plugin is another link between the two.

The alpha version of this
Visual Studio plugin is impressive and provides everything you need to build
Node.js applications. I tested it with Visual Studio 2012 and 2013 and encountered repeated issues with the plugin crashing the IDE in Visual Studio
2012. It's an alpha version, so I expect the kinks will be worked out with
subsequent releases.

Overall, this is a great tool if you're a Microsoft developer who is looking to dive into Node.js development.

Related Topics:

About Tony Patton

Tony Patton has worn many hats over his 15+ years in the IT industry while witnessing many technologies come and go. He currently focuses on .NET and Web Development while trying to grasp the many facets of supporting such technologies in a productio...

Full Bio

Tony Patton has worn many hats over his 15+ years in the IT industry while witnessing many technologies come and go. He currently focuses on .NET and Web Development while trying to grasp the many facets of supporting such technologies in a production environment on a daily basis.