Scripted way to add nuget package source

亡梦爱人 提交于 2020-07-17 10:04:21

问题


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?

We basically don't want to go

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

on every developer machine in the company.


回答1:


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

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 introduced system wide package source configuration in ProgramData. So you could add your package sources into NuGet.config under ProgramData with your installer.



来源:https://stackoverflow.com/questions/19001158/scripted-way-to-add-nuget-package-source

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!