Azure Pipelines .net core 3.1 库以及对其他库的引用如何创建一个 nuget 包

标签 azure .net-core nuget azure-pipelines nuget-package

我有包含 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/

相关文章:

Azure Functions 在 AppInsights 中缺少行

c# - 如何在 EF.core 中使用 FromSqlRaw 特定列

svn - 我还必须将第三方库二进制文件保留在源代码管理中吗?

azure - 适合存储 Web 服务输出缓存的云服务吗?

azure - 虚拟助理 -> LUIS、QnA、调度程序最佳实践

asp.net - 运行 ASP.NET Web 应用程序时找不到 System.Runtime 4.1.0.0

c# - 如何在构建使用包的 C# 代码期间从 NuGet 包复制文本文件?

dependencies - NuGet - 使用 "Create New NuGet Package after each build"包时在 .nuspec 文件中添加组依赖项

Azure Function CosmosDB 触发器返回编码数据?

c# - 调用 Blazor 应用程序时,Postman 调用无限旋转