具有 nuget 构建目标的 .Net 标准项目

.Net Standard project with nugets build target

我正在使用:

dotnet pack MyProject.csproj

用于创建 nuget netstandard/net462 包,它适用于简单的用例。

如何配置 MyProject.csproj 以在 "build" nuget 级别中包含文件? 或者我可以从 .csproj 添加对 nuspec 文件的引用吗?

这是 .nuspec 文件中的样子:

<package>
    <files>
        <file src="Libs\*.*" target="build" />
    </files>
</package>

csproj 中有一个标记指向要使用的 nuspec 文件而不是 csproj:

  <NuspecFile>MyLibrary.nuspec</NuspecFile>
  <NuspecProperties>version=$(Version);id=$(AssemblyName)</NuspecProperties>