gpt4 book ai didi

nuget - 阻止发布到公共(public) NuGet 库

转载 作者:行者123 更新时间:2023-12-03 18:06:12 29 4
gpt4 key购买 nike

我们使用 NuGet 来打包我们的内部依赖项。我们正在为这些设置一个私有(private) NuGet 存储库。

但是,我担心有人可能会不小心将我们的某个包发布到公共(public) NuGet 存储库。

我可以防止这种情况吗?

最佳答案

您可以定义NuGet.config带有 DefaultPushSource 的文件引用内部 NuGet Gallery 实例的值。将配置文件放在您的内部包旁边 nuspec文件。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="DefaultPushSource" value="https://nuget.example.com" />
</config>
</configuration>

In general the NuGet.config file closest to the folder nuget.exe runs from wins, the section below walks through the details.

NuGet first loads NuGet.config from the default location, then loads any file named NuGet.config starting from the root of the current drive and ending in the current directory.

Chaining multiple configuration files

The NuGet Config Defaults file also allows specification of the Default Push Source. This will be the default push source if one is not provided in the command line argument of nuget.exe. Without a default push source specifid in the NuGet Config Defaults file, nuget.org is the default nuget.exe push source. Using the new configuration though, administrators can change the default push source to an internal package soure. This will help prevent accidental publishing of packages to nuget.org.

Default NuGet.exe Push Source

关于nuget - 阻止发布到公共(public) NuGet 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11948815/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com