NuGet代理背后 [英] NuGet behind a proxy

查看:142
本文介绍了NuGet代理背后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现NuGet从1.4版本开始允许代理设置配置.但是,我找不到任何命令行示例.

I figure out that NuGet allows proxy settings configuration since 1.4 version. But, I can't find any command line example.

我正在尝试运行某些构建,而NuGet无法连接.

I'm trying to run some build and NuGet can't connect.

如何在命令行上配置代理设置?

How do I configure the proxy settings on the command line?

推荐答案

这就是我与使用NTLM身份验证的公司代理一起使用时要做的事情.我下载了 NuGet.exe ,然后运行了以下命令(在在CodePlex上对此讨论的评论):

Here's what I did to get this working with my corporate proxy that uses NTLM authentication. I downloaded NuGet.exe and then ran the following commands (which I found in the comments to this discussion on CodePlex):

nuget.exe config -set http_proxy=http://my.proxy.address:port
nuget.exe config -set http_proxy.user=mydomain\myUserName
nuget.exe config -set http_proxy.password=mySuperSecretPassword

这会将以下内容放入位于%appdata%\NuGet的我的NuGet.config中(它映射到Windows 7计算机上的 C:\ Users \ myUserName \ AppData \ Roaming ):

This put the following in my NuGet.config located at %appdata%\NuGet (which maps to C:\Users\myUserName\AppData\Roaming on my Windows 7 machine):

<configuration>
    <!-- stuff -->
    <config>
        <add key="http_proxy" value="http://my.proxy.address:port" />
        <add key="http_proxy.user" value="mydomain\myUserName" />
        <add key="http_proxy.password" value="base64encodedHopefullyEncryptedPassword" />
    </config>
    <!-- stuff -->
</configuration>

顺便说一句,这也解决了我与NuGet的问题,仅当我第一次在Visual Studio中访问程序包源时才有效.

Incidentally, this also fixed my issue with NuGet only working the first time I hit the package source in Visual Studio.

请注意,一些尝试过此方法的人通过评论报告说,他们能够从命令行中省略设置http_proxy.password键,或事后从配置文件中将其删除. ,并且仍然能够在代理中具有NuGet功能.

Note that some people who have tried this approach have reported through the comments that they have been able to omit setting the http_proxy.password key from the command line, or delete it after-the-fact from the config file, and were still able to have NuGet function across the proxy.

但是,如果您发现必须必须在NuGet配置文件中指定密码,请记住,当您执行以下操作时,必须从命令行更新存储在NuGet配置中的密码如果您的代理凭据也是您的网络凭据,请更改您的网络登录名.

If you find, however, that you must specify your password in the NuGet config file, remember that you have to update the stored password in the NuGet config from the command line when you change your network login, if your proxy credentials are also your network credentials.

这篇关于NuGet代理背后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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