title: Using Process.Start to clean a solution - devenv.exe keeps .pdb file open
body: <p>I am cleaning a solution programmatically using:</p>
  
  <pre><code>var cleanProcess = Process.Start(@"e:\Program Files (x86)\Visual Studio\Common7\IDE\devenv.exe", string.Format(@"{0}\{1}.sln /clean", _solutionFolder, _solutionName));
  cleanProcess.WaitForExit();
  </code></pre>
  
  <p>But this doesn't remove all the files from the bin folder (it does for some solutions but not for others) so afterwards I am trying to delete all the files in the bin folder, but it doesn't work because devenv.exe still has the .pdb file open. </p>
  
  <p>I've tried manually deleting them too, so it's not to do with the deletion code.</p>
  
  <p>I've also tried adding <code>cleanProcess.Dispose();</code> afterwards and that makes no difference. I've also tried <code>cleanProcess.Kill();</code> but that doesn't work because the process is already closed.</p>
  
  <p>How can I close the file even after the process has been stopped? Or is there another way to make sure <code>/clean</code> removes all files?</p>