title: Upgrade Visual Studio solution and project files programmatically
body: <p>I have a lot of visual studio projects which are delivered to the customer using installer. After the installation all project and solution files should be of the latest installed visual studio version. Is there any way to convert a lot of projects <strong>fast</strong>?</p>
  
  <p>I've tried following:</p>
  
  <p>1) parsing the files and replacing different properties like <code>ToolsVersion</code> etc. It's fast but not reliable and should be changed for every new Visual Studio which comes to the market (yearly from now AFAIK)</p>
  
  <p>2) Using devenv upgrade feature, reliable but VERY slow:</p>
  
  <pre><code>string[] files = Directory.GetFiles(@"c:\MyTmp", "*.sln", SearchOption.AllDirectories);
  foreach (string file in files)
  {
      Process process = new Process();
      process.StartInfo.FileName = pathToTheLatestVS;
      process.StartInfo.Arguments = "/Upgrade \"" + file + "\"";
      process.Start();
      process.WaitForExit();
  }
  </code></pre>
  
  <p>3) Tried to create a hidden instance of VS and manipulate solutions from there as described <a href="https://stackoverflow.com/questions/1172383/open-a-vs-2005-solution-file-sln-into-memory">here</a>, but no luck.</p>
  
  <p>So is that possible to upgrade many project/solution files to a specific Visual Studio version in fast and reliable way?</p>