添加 nuget 包源的脚本化方式 [英] Scripted way to add nuget package source

查看:68
本文介绍了添加 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 http://YourFeed.com

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

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 包源的脚本化方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆