在 Visual Studio 中使用 CodeArtifact
Amazon CodeArtifact 是一项完全托管的构件存储库服务,可让组织轻松安全地存储和共享用于应用程序开发的软件包。您可以将 CodeArtifact 与常用的构建工具和程序包管理器配合使用,例如 NuGet 和.NET Core CLI 以及 Visual Studio。您还可以将 CodeArtifact 配置为从外部公共存储库(例如 NuGet.org
在 CodeArtifact 中,您的程序包存储在存储库中,而后者存储在域中。Amazon Toolkit for Visual Studio 简化了 Visual Studio 使用 CodeArtifact 存储库时的配置,从而可以轻松地在 Visual Studio 中直接使用 CodeArtifact 和 Nuget.org 中的程序包。
将您的 CodeArtifact 存储库添加为 NuGet 程序包来源
要使用来自 CodeArtifact 的程序包,您需要在 Visual Studio 的 NuGet Package Manager 中将存储库作为可打包来源添加
将您的存储库添加为程序包来源
-
在 Amazon 各区服务浏览器中,导航到 Amazon CodeArtifact 节点中的存储库。
-
打开要添加的存储库的上下文(右键单击)菜单,然后选择复制 NuGet 来源端点。
-
在工具 > 选项菜单中,导航到 NuGet Package Manager 节点下的程序包来源。
-
在程序包来源中,选择加号(+),编辑名称,然后将之前复制的 NuGet 来源端点 URL 粘贴到来源字段中。
-
选中新添加的程序包来源旁的复选框以启用该来源。
注意
我们建议在 CodeArtifact 中添加指向 NuGet.org 的外部连接,并在 Visual Studio 中禁用 nuget.org 程序包来源。使用外部连接时,从 NuGet.org 提取的所有依赖项都存储在 CodeArtifact 中。如果 NuGet.org 因任何原因出现故障,您需要的程序包仍然可用。有关外部连接的更多信息,请参阅《Amazon CodeArtifact User Guide》中的 Add an external connection。
-
选择确定以关闭菜单。
有关将 CodeArtifact 与 Visual Studio 配合使用的更多信息,请参阅《Amazon CodeArtifact User Guide》中的 Use CodeArtifact with Visual Studio。