Node.js and Visual Studio? Sure!

  • Mar 24, 2014 at 12:43 AM
  • Shawn Wildermuth
  • 4 Comments

nodejsI’ve been working on a new course for Pluralsight on “Node.js for .NET Developers”. It’s been a fun course to write and one of the aspects of the course that I find interesting is that the open source Node.js Tools for Visual Studio plugin actually works really well.

What I particular like is that it doesn’t change the way you use Node.js – it can live side-by-side with command-line tooling like NPM, Bower, or even node.exe. It doesn’t try to do more than it should.

Once you install the tooling, it’s as easy as creating a new project (empty or a boilerplate with Express.js). It even has a project type for an existing node.js project:

image

For me the big win here is the debugging support. It still uses Node.exe to run the project, but running a project connects the, very good, Visual Studio debugger to the node.exe process. The experience working here is like most debugging in Visual Studio. All your experience with debugging works here:

image

But I have to admit, that I don’t use the built-in NPM manager. I understand that they’ve added this to mimic the experience you have with Nuget but overall I find use NPM in the command shell just quicker:

image

There are two issues that are annoying when using it, but I think they are mostly due to the “Alpha” release version of the tool.  These are:

1. “Module not Defined” exception being caught by default. This issue is that many many Node.js packages work with optional dependencies which means that a “Module not Defined” is expected in a lot of cases. This is easy to fix as you can simply tell Visual Studio to not stop on this exception after the first one. But it rears it’s ugly head quite a bit when you first get started.

2. JavaScript editor is screwy. The problem here is that there is a specific Node.js editor surface for the tool and that doesn’t do JavaScript very well. You can change it to use the default editor but that still seems screwy under these projects.

Luckily, you can do what I do and continue to use Sublime Text as your editor and just drop down into VS when you need debugging. This Node.js Tools for Visual Studio is a good first step (it is only in Alpha) and is very usable. If you’re comfortable with Visual Studio, it is a big leg up in working with Node.js. At this point it isn’t a replacement for using WebStorm or other richer IDEs for Node.js but it is comfortable for my old .NET skillset.

What do you think?

 

Comments

Gravatar

Paul Monday, March 24, 2014

I think these tools looks great and another nice effort from msft however as you said, they're not a replacement for something like webstorm at the moment. I've been a .net dev since 1.0 so visual studio has been my home for many a year but when I work outside of the stack, I don't try to make it bend to my needs, I just use webstorm which does everything I could need including being a very familiar transition to anyone who uses resharper. I'm not sure I see the value in using sublime and then switching to vs for debugging. Every time I think of giving sublime a really good try I just see all the features that come out of the box with webstorm (plus the large plug-in ecosystem) and there's just nothing I'm missing (ok, multiple cursors is nice but is in the latest eap).

Anway, NTVS is extremely impressive for an initial release and one to keep an eye on. Nothing wrong with too many options! ;-)

BTW, how come your email field doesn't allow '+' in the email name?

Gravatar

sm Tuesday, March 25, 2014

great write up!

just a quick note that the latest dev builds have some of the issues fixed & the 1.0 Beta will be available at Build in a week or so with various new features & many fixes!

Gravatar

Shawn Wildermuth Tuesday, March 25, 2014

sm,

Yes, that's what I gathered. It was only an Alpha. I am looking forward to the Beta.


Leave a Comment

*
*
*