我有包含 10 个 .net core 3.1 库项目的 Visual Studio 解决方案(我们称之为 CORE)。其中之一是主要项目。它引用了其他项目。
我想要一个 nuget 包(存储在 azure feed 中),我可以在其他解决方案中使用它,因为我不会每次需要核心功能时都添加所有 dll。我需要定义 Azure Pipeline 来完成这项工作。如何定义生成一个包含所有其他引用(dll)的包的管道?
最佳答案
构建 NuGet 包时,可以向 nuget pack
命令提供 -IncludeReferencedProjects
开关,引用的项目将作为包的一部分添加:
nuget pack MyProject.csproj -IncludeReferencedProjects
请注意,根据 the docs :
If a referenced project includes a .nuspec file of its own, then NuGet adds that referenced project as a dependency instead. You need to package and publish that project separately.
我建议您熟悉this article 。有更多选项可以精细控制包裹的内容。此处引用的原始 nuget
命令可以轻松映射到适当的 CI 任务。
关于Azure Pipelines .net core 3.1 库以及对其他库的引用如何创建一个 nuget 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68316996/