4

I have a custom Nuget package that contains CSS and JavaScript files. Every time I install this to my ASP.Net core project nothing happens: - no folders are created in wwwroot - and no files are copied to wwwroot The only thing that is added to the project is a reference in project.json.

Install the same package to a console app and it works!

Any ideas.. thanks in advance?

RKD
  • 426
  • 1
  • 5
  • 12
  • Is it a public package so we can test it too? Did you check if the files are going to the package folder? – Fabricio Koch Nov 30 '16 at 16:54
  • afaik it is possible to pack static resource files into the nuget but currently you can't get them out. I think now it is frowned upon to package static resources via nuget and they recommend using client side package manager for that. in my own class library nugets I've embedded css and js and serve them from a controller as a workaround – Joe Audette Nov 30 '16 at 17:33
  • It's possible to extract static files from NuGet package, CSS and JavaScript files are no different than DLLs. I've been through this pain for several months. You can read [my answer](http://stackoverflow.com/a/40652794/1203116) to my own question. The only difference with you is that I have an ASP.NET Core project targeting full .NET Framework. But I don't see any reason my solution wouldn't work targeting .NET Standard or .NET Core – Jérôme MEVEL Dec 01 '16 at 01:04
  • .NET Core projects use `PackageReference` by default, which means your `.nuspec` needs to be structured differently -- you need a `contentFiles` element instead of (or in addition to `files`). See the blog post [contentFiles demysitified](https://blog.nuget.org/20160126/nuget-contentFiles-demystified.html). – David Feb 26 '18 at 17:59
  • 1
    This doesn't totally fix the problem, at least not for me -- the files do get installed to the ASP.NET Core project, but as links rather than regular files. Still working on that part :( – David Feb 26 '18 at 18:00
  • We are encountering this very issue. We have nuget'd up some css/js and when it is referenced it can be seen by only as a reference via package reference. Not via file references. – Jon H Mar 20 '18 at 21:08

0 Answers0