In the TFS 2010 API you can add a proxy via AddProxy as men开发者_StackOverflow中文版tioned here
We have to use TFS 2008 SDK however so I wonder if it is possible to do something similar with that one?
The AddProxy() method is used to register a list of proxy servers with the TFS server, so that clients can automatically detect & use a proxy server.
TFS2008 does not keep a list of TFS Proxy servers, so it is not possible with the TFS 2008 SDK.
If you just want to configure your client to use a proxy server, there is no property to do this. You have to set a registry key or an undocumented environment variable.
For TFS2008 clients, the registry key is:
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\SourceControl\Proxy]
"Enabled"="True"
"Url"="http://someproxy:8081"
For TFS2010 clients, the registry key is:
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Proxy]
"Enabled"="True"
"Url"="http://someproxy:8081"
In either TFS version, you can set the undocumented environment variable:
System.Environment.SetEnvironmentVariable("TFSPROXY",http://someproxy:8081);
精彩评论