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.
- 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.
- 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.
Node.js IntelliSense support in Visual Studio eases development.
Debugging Node.js code in Visual Studio follows normal path (hit F5).
Node.js Tools for Visual Studio debugging menu options.
Deploying Node.js application to Azure via Visual Studio publish feature.
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.
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.
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.