Cover

Intellisense in ASP.NET Core Projects That Use NPM?

September 8, 2018
No Comments.

I’ve been advocating using NPM for a client-side package manager in the last few months since Bower support has been depreciated. And while this works pretty well (using Scott Allen’s UseNodeModules middlware) to allow you to just point at the NPM folder.

Of course, for production, this isn’t a great solution. I’ve been showing people to use Gulp or WebPack to copy only the files you need in production. But for development, there is a problem: Intellisense.

I’ve noticed that Visual Studio 2017 only seems to notice files in the wwwroot folder. After trying a bunch of things, I think I found a solution. If you open the CSPROJ file and add this section to point at the node_modules directory:

  <ItemGroup>
    <None Include="node_modules/**" />
  </ItemGroup>

It seems to be picking up the JS and CSS intellisense for me. Let me know if you see it work too!