Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I include JavaScript packages I install from Nuget?

Tags:

Possibly a stupid question. I installed Chart.js using package manager. It's in Solution explorer.

enter image description here

But where are the actual JS files or how do I get them? When I installed it, there are no changes that Git detects, so I'm not sure if anything at all happened.

like image 688
user7127000 Avatar asked Apr 19 '17 03:04

user7127000


1 Answers

Chart.js 2.5.0 includes a Content\Scripts directory inside its NuGet package which contains a Chart.js and Chart.min.js. Depending on what sort of project you are using these files may or may not be added directly into your project.

If you are using a .NET Framework project that has a packages.config file then the JavaScript files will be added into a Scripts folder into your project.

If you are using a project.json file, or your project uses PackageReferences, then nothing will be added since this sort of project only supports files that are in a contentFiles directory inside the NuGet package. Your project looks like a .NET Core project which will use PackageReferences. The Chart.js NuGet package itself will be in the %UserProfile%\.nuget\packages directory if you need to get the javascript files.

Tseng's answer that recommends switching to using Bower or the Node Package Manager to add the JavaScript files seems like the best solution here instead of using NuGet, which does not have good support for adding source files to your project for newer project file formats.

like image 172
Matt Ward Avatar answered Oct 20 '22 20:10

Matt Ward