Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I know i must be missing something incredibly obvious, but where are the js files? I install the package via nuget, but when i check for the js files to include them in my page, i cannot find them anywhere.

What do i do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
328 views
Welcome To Ask or Share your Answers For Others

1 Answer

Over the years getting web front end resource (html, css, js) though NuGet has fallen out of favour. I expect it's largely due to lack of flexibility (the developer using the package can't decide where the files go, the package author does). I get the sense that large numbers of ASP.NET developers moved to using the same tools that non-.NET developers use for these files, which primarily is npm. You can see this with ASP.NET Core's angular and react templates using npm by default. The webapp and mvc templates now just ship some version of bootstrap and jquery in their template with no tooling support to update them, just a comment saying:

/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification for details on configuring this project to bundle and minify static web assets. */

Since using npm's ecosystem is non-trivial (not saying it's hard, just non-trivial), the ASP.NET team created a simple library manager called LibMan.

So, I suggest either using LibMan to get jquery and whatever other front-end resources you want, or go down as far down the npm/webpack rabbit-hole as you like, you can make it as simple or complex as you like depending on what features you want. Or just download the file from jquery's website and copy it into your repo.

The reason that the NuGet package doesn't work for you is because the package contains only a content folder, but NuGet's docs on migrating from packages.config to packagereference specifically points out that "content" assets are no longer available. Package authors can use contentFiles to make their packages compatible with projects using PackageReference, but there's nothing a package consumer can do about it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...