【问题标题】:NuGet package from project.json with content files来自 project.json 的 NuGet 包和内容文件
【发布时间】:2016-09-16 09:40:39
【问题描述】:

我正在制作一个包含一些视图和控制器的 NuGet 包,我希望将它们包含在许多 MVC Core 1 项目中,以便我们可以共享应用程序领域,例如用户管理。

通过这些打包选项,我获得了一个确实包含文件的 .nupkg。

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

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

但是,.nupkg 中的 .nuspec 文件不包含任何文件元素,因此包含的文件不会被复制到目标项目中。

我需要做什么才能在 .nuspec 文件中生成 files 元素?

【问题讨论】:

    标签: nuget asp.net-core-1.0


    【解决方案1】:

    dotnetcore 中的 NuGet 包不适用于内容文件共享。您可以将文件嵌入到您的程序集中或使用 Bower。

    见:

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

    Sharing ViewComponents Between ASP.NET 5 Projects

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-12
      • 2020-05-02
      • 2021-03-13
      • 1970-01-01
      • 1970-01-01
      • 2016-12-21
      • 2021-02-19
      • 1970-01-01
      相关资源
      最近更新 更多