Trying to write a [plugin](http://msdn.microsoft.com/en-us/library/gg695782.aspx) for Dynamics CRM 2011 Online.

The first step is to use CrmSvcUtil to generate the code for the entity classes.

I think I've got the CrmSvcUtil parameters right (see below) but when I run it I get:

> 
> Exiting program with exception: Metadata contains a reference that cannot be resolved:
>  '<https://myorg.crm.dynamics.com/XRMServices/2011/Organization.svc?wsdl>'.
>  Enable tracing and view the trace files for more information.
> 
> 
> 

Enabling tracing (via the CrmSvcUtil.exe.config) reveals this error:

> 
> ---> System.Net.WebException: The remote server returned an error: 
>  (407) Proxy Authentication Required.  
> 
>  at System.Net.HttpWebRequest.GetResponse()  
> 
>  at System.ServiceModel.Description.MetadataExchangeClient.
>  MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper)  
> 
>  etc ...
> 
> 
> 

This makes sense because the network I am on has a proxy server that requires my network username/password to get to the internet. Naturally, this username/password is different to the Dynamics CRM one.

So, how do I get CrmSvcUtil to pass the right username/password to the proxy?

Here's the config file that I'm using with CrmSvcUtil:

```
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="url" value="https://myorg.crm.dynamics.com/XRMServices/2011/Organization.svc"/>
    <add key="codeCustomization" value="Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration"/>
    <add key="out" value="XRM\Xrm.cs"/>
    <add key="namespace" value="Xrm"/>
    <add key="username" value="myusername@fordynamics.com"/>
    <add key="password" value="mydynamicspassword"/>
    <add key="deviceid" value="my device ID"/>
    <add key="devicepassword" value="my device password"/>
    <add key="servicecontextname" value="XrmServiceContext" />
    <add key="servicecontextprefix" value="Xrm" />
  </appSettings>

  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <add name="configConsoleListener"
        type="System.Diagnostics.ConsoleTraceListener">
          <filter type="System.Diagnostics.EventTypeFilter"
          initializeData="Error" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>

</configuration>

```