13

I'm developing a large client-side javascript app, which requires a complex tree of Javascript dependencies, all of which are available as npm modules. Most modules I require are not available as nugets, I'd like to get it so adding npm modules to my webapp is as simple as adding nugets.

Is it possible/reasonable to use npm to install packages "into" my ASP.NET MVC project?

4 Answers 4

7

You can check Bower. That is client package manager. It suits for asp.net mvc. Here some help:

Sign up to request clarification or add additional context in comments.

Comments

5

npm support has been added to Visual Studio as of 2013 update 3:

http://www.hanselman.com/blog/IntroducingGulpGruntBowerAndNpmSupportForVisualStudio.aspx

Comments

1

You can now install packages by adding "Package.json" into your ASP MVC project and then add the packages you need. Visual Studio will install based on the packages included in your "Package.json" file.

Comments

1

Microsoft provide a tutorial for using NPM modules in visual studio projects: https://learn.microsoft.com/en-us/visualstudio/javascript/npm-package-management?view=vs-2022#aspnet-core-projects

Notice that, for ASP.NET projects, guidance is only given for Core projects and not MVC projects, showing that MVC projects don't natively support NPM.

I have not managed to use any other packages to set up NPM inside ASP.NET MVC projects, and have found that the best solution is to migrate the project over to Core, which Microsoft give a tutorial for (references to ASP.NET on its own generally refer to the MVC version) : https://learn.microsoft.com/en-us/aspnet/core/migration/proper-to-2x/?view=aspnetcore-7.0

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.