【问题标题】:Add additional nuget servers at global level在全局级别添加其他 nuget 服务器
【发布时间】:2019-11-26 12:42:48
【问题描述】:

我创建了一个 nuget 包形式的 dotnet new 模板并上传到我的私有 nuget 服务器。我想知道如何在我的计算机上全局添加私有 nuget 服务器。这样,每当我执行 dotnet new CustomTemplate 时,它都会从 nuget 服务器中提取最新版本。任何帮助将不胜感激谢谢!

【问题讨论】:

    标签: .net visual-studio asp.net-core .net-core nuget


    【解决方案1】:

    我想知道如何在我的计算机上添加全局级别的私有 nuget 服务器。

    Here are the docs on where NuGet reads configuration。您可以看到将源代码添加到 Windows 上的 %appdata%\NuGet\NuGet.Config 或 Mac 或 Linux 上的 ~/.nuget/NuGet/NuGet.Config 应该可以完成这项工作。

    这可能很明显,但请记住,如果您共享的项目使用来自该源的包,那么其他人(包括 CI 构建代理)将无法恢复这些包,除非他们也将源添加给他们的用户配置文件nuget.config,或者如果有人添加了nuget.config 与repo 的源。如果你只是用它来获取项目模板,那也不是问题。

    【讨论】:

      【解决方案2】:

      在 Windows 中,您可以在位于此路径的 网络服务 级别添加 NuGet 配置:

      C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\NuGet\NuGet.Config

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-02-09
        • 2018-05-28
        • 2021-06-29
        • 2012-02-03
        • 1970-01-01
        相关资源
        最近更新 更多