Mar*_*rio 8 visual-studio nuget visual-studio-2017
因为我们有一个内部服务器在工作,所以我向Visual Studio添加了一个nuget“包源”。
现在,Visual Studio始终默认使用我的内部服务器,并且在我将包源切换为All或之前,无法找到我们的大多数nuget包。nuget.org
这是一个小小的麻烦,但是在过去的几周里,每次我需要与nuget软件包管理器一起工作时,我都会做更多的点击。谁能告诉我如何默认All而不是始终默认为Internal nuget?
Leo*_*SFT 11
谁能告诉我如何默认全部而不是始终将其默认为Internal nuget?
据我所知,NuGet软件包管理器的默认软件包来源取决于软件包来源的顺序和activePackageSourcein中的属性nuget.config。
包源码的顺序:
当您打开NuGet软件包管理器设置时,在工具->选项-> NuGet打包程序管理器->软件包源中,您会注意到软件包源有上下箭头:
NuGet软件包管理器将在软件包来源列表顶部为默认nuget软件包来源赋予优先级。例如,如果我LocalServer在该列表的顶部设置了nuget包源,则在创建新项目时,默认的nuget包源将更改为LocalServer:
但是,可以通过nuget.config中activePackageSource的属性轻松打破默认nuget源的优先级。
从%appdata%\ NuGet \ NuGet.config打开nuget.config文件,添加以下代码:
<activePackageSource>
<add key="LocalServer2" value="D:\LocalServerTest" />
</activePackageSource>
Run Code Online (Sandbox Code Playgroud)
重新启动Visual Studio,然后创建一个新项目,您会发现默认的nuget源更改为LocalServer2:
因此,如果要默认nuget.org而不是始终将其默认设置为Internal nuget,则可以nuget.org在nuget源列表的顶部设置nuget源,或在nuget.config中将设置nuget.org为activePackageSource:
<activePackageSource>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</activePackageSource>
Run Code Online (Sandbox Code Playgroud)
更新评论:
没有办法默认为全部吗?也许您可以建议默认为“全部”(看起来像您为MS工作)
如果要将默认的nuget源设置为All,则可以在下面的设置中使用nuget.config:
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5942 次 |
| 最近记录: |