title: C# process cannot access file because it is being used by another process
body: <p>I am writing an importer in C# for an XML file. Every time I run the import I need to download the XML file from a URL.</p>
  <p>I have wirtten the following code to download it:</p>
  <pre><code>var xmlPath = @&quot;C:\Desktop\xxx.xml&quot;;
  public void DownloadFile(string url, string saveAs)
  {
      using(var webClient = new WebClient())
      {
          webClient.DownloadFileAsync(new Uri(url), saveAs);
      }
  }
  </code></pre>
  <p>and  <code>_downloader.DownloadFile(Config.FeedUrl, xmlPath);</code> to call the method. The Url is in the config file (<code>Config.FeedUrl</code>).</p>
  <p>Then when I am trying to <code>GetProperties(xmlPath);</code> I get the Exception &quot;Process Cannot access the file because the file is being used by another process.</p>
  <p>I made sure that the destination exists but I am not sure why I get this error.</p>