MSBuild multiple dll in a single NuGet package

前端 未结 4 1104
清歌不尽
清歌不尽 2020-12-15 10:11

I have a Visual Studio 2017 solution that contains two projects:

Foo.csproj
Foo.Core.csproj

Both of these projects target multiple framewor

4条回答
  •  失恋的感觉
    2020-12-15 10:41

    Been struggling with the same issue and none of the suggested workarounds worked (https://github.com/NuGet/Home/issues/3891) and I couldn't change the csproj to use the new SDK coming with .netcore.

    Luckily the nuget pack command comes with the -IncludeReferencedProjects option (ref: https://docs.microsoft.com/en-us/nuget/tools/cli-ref-pack) which does exactly that: "Indicates that the built package should include referenced projects either as dependencies or as part of the package. If a referenced project has a corresponding .nuspec file that has the same name as the project, then that referenced project is added as a dependency. Otherwise, the referenced project is added as part of the package."

    Regardless of the *.nuspec file (not needed here) , add -IncludeReferencedProjects to the pack command and the referenced project dlls will be included along with the nuget dll.

    nuget.exe pack yourProject.csproj -IncludeReferencedProjects
    

提交回复
热议问题