Richard Barraclough
Richard Barraclough

Reputation: 2984

NuGet package from project.json with content files

I'm making a NuGet package containing some views and controllers that I want to include in a number of MVC Core 1 projects so that we can share application areas such as user management.

With these pack options I am obtaining a .nupkg that does indeed contain the files.

     "scripts": {
    "postcompile": [ "dotnet pack --no-build --configuration %compile:Configuration%" ] // rwb
  },

  "packOptions": {
    ...
    "files": {
      "include": [ "wwwroot/**.*", "Views/**.*" ]
    }
}

However, the .nuspec file inside the .nupkg does not contain any files elements and thus the included files do not get copied into the target project.

What do I need to do in order to get the files element to be produced in the .nuspec file?

Upvotes: 1

Views: 881

Answers (1)

Stefan P.
Stefan P.

Reputation: 9519

NuGet packages in dotnetcore are not intended for content file sharing. You can embed the files in your assembly or use Bower.

See:

contentFiles, project.json and ASP.NET (5/core 1.0) projects

Sharing ViewComponents Between ASP.NET 5 Projects

Upvotes: 1

Related Questions