添加 nuget 包源的脚本化方式

编程入门 行业动态 更新时间:2024-10-25 22:24:39
本文介绍了添加 nuget 包源的脚本化方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们想启动一个公司 nuget 包存储库.有没有办法通过命令行添加包源,以便我们可以通过设置或其他方式配置我们的新包源?

We want to start a company nuget package repository. Is there a way to add a package source through command line so we can configure our new package source through a setup or something?

我们基本上不想去

工具 - 选项 - 包管理器 - 包源 - 加号按钮 -添加名称和来源

Tools - Options - Package Manager - Package Sources - Plus button - add name and source

在公司的每台开发人员机器上.

on every developer machine in the company.

推荐答案

包源存储在用户配置文件下的 NuGet.config 或 ProgramData 的系统范围内:

The package sources are stored in NuGet.config under the user's profile or system wide in ProgramData:

%AppData%\NuGet\NuGet.config %ProgramData%\NuGet\NuGetDefaults.config

您可以使用类似于以下内容的命令行通过 NuGet 添加包源:

You can add package sources through NuGet using a command line similar to:

nuget sources add -name FeedName -Source YourFeed

如果您在用户的配置文件下运行上面的命令将起作用.

The above command will work if you run it under the user's profile.

NuGet 2.7 在 ProgramData 中引入了系统范围的包源配置.因此,您可以使用安装程序将包源添加到 ProgramData 下的 NuGet.config 中.

NuGet 2.7 introduced system wide package source configuration in ProgramData. So you could add your package sources into NuGet.config under ProgramData with your installer.

更多推荐

添加 nuget 包源的脚本化方式

本文发布于:2023-11-10 10:00:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575073.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   方式   nuget

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!