How to set proxy in visual studio 2015
Asked Answered
O

3

8

I'm Using Visual Studio 2015 for Xamarin app development and I'm working behind corporate proxy, I need to set the proxy(http proxy) to the Visual studio 2015, so how could I get such window to set proxy ?

Orthostichy answered 30/1, 2017 at 12:55 Comment(0)
W
25

Find devenv.exe.config in your installation directory.

Now open this text file and add the node <defaultProxy> inside the node <system.net>.

<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
    <proxy bypassonlocal="true" proxyaddress="http://yourproxyaddress.net:8080" />
</defaultProxy>
</system.net>

If your proxy requires authentication, you should add those as parameters in the proxy URL

<system.net>
<defaultProxy useDefaultCredentials="true" enabled="true">
    <proxy bypassonlocal="true" proxyaddress="http://Username:[email protected]:8080" />
</defaultProxy>
</system.net>
Weatherworn answered 30/1, 2017 at 13:2 Comment(5)
[Proxy Authorization Required](msdn.microsoft.com/en-us/library/dn771556.aspx )Labor
when I do this I get an error "Failed to merge configuration" at startupRockoon
It took me a while because I have no admin rights at my workplace and had no access to devenv.exe.config in installation directory. Fortunately it's also possible to set the default proxy in user config file. For me it's under "%LocalAppData%\Microsoft\VisualStudio\15.0_fd6939ab\devenv.exe.config"Mescaline
The only solution that worked for me. if you are using Datatool 2010, you need to change the v10 versionLyophilic
Worked perfectly in Visual Studio 2019. Thanks!Lenoir
K
1

For the folks that are behind a proxy and using Visual Studio 2017 on Windows 10, this is what I did.

  1. Type "setting" or "proxy" in the search bar and select Settings or the link pointing to Network & Internet > Proxy
  2. At the bottom you will see Manual proxy setup
  3. Turn on the Use a proxy server and put your company address and port and any other setting you moght find relevant (like bypass for local addresses)
Keister answered 3/1, 2019 at 18:11 Comment(0)
H
0

You could create your own proxy authentication module like descriped here:

https://blogs.msdn.microsoft.com/rido/2010/05/06/how-to-connect-to-tfs-through-authenticated-web-proxy/

First create a new Visual C# Project -> Class Library (.Net Framework): Name: ProxyModule (for example). USER, PWD and PROXY must be set to the correct string values:

using System.Net;
using System.Net.Sockets;

namespace ProxyModule
{
  public class AuthProxyModule : IWebProxy
  {
    ICredentials crendential = new NetworkCredential("USER", "PWD");

    public ICredentials Credentials
    {
        get
        {
            return crendential;
        }
        set
        {
            crendential = value;
        }
    }

    public Uri GetProxy(Uri destination)
    {
        return new Uri("http://PROXY:8000", UriKind.Absolute);
    }

    public bool IsBypassed(Uri host)
    {
        return host.IsLoopback;
    }
  }
}

and copy the created "ProxyModule.dll" to the "...\Common7\IDE" folder, VS 2015:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE

or VS professional 2017:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE

Then you must extend the system.net part in the devenv.exe.config in the same folder:

<system.net>
  <defaultProxy>
    <module type="ProxyModule.AuthProxyModule, ProxyModule"/>
  </defaultProxy>
</system.net>

If you don´t want to use the proxy in some cases you can extend the method "IsBypassed(Uri host)". Maybe you could check your own IP to enable or disable the proxy (return false to disable the proxy).

Highwayman answered 17/1, 2018 at 13:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.