title: Can one cast an EnvDTE.Project into a VCProject
body: <p>I have seen two posts so far that concern my question. I am wondering how can one cast an EnvDTE.Project into a VCProject. </p>
  
  <p>In <a href="https://stackoverflow.com/questions/1683642/vb-net-envdte-up-to-date-check-before-building-project">this post</a>, <em>fun4jimmy</em>'s answer does that exactly in the following line of code (taken from his answer) : </p>
  
  <blockquote>
  <pre><code>VCProject vcProject = project.Object as VCProject;
  </code></pre>
  </blockquote>
  
  <p>I have tried doing the same thing in my solution : </p>
  
  <pre><code>using EnvDTE;
  using Microsoft.VisualStudio.VCProjectEngine;
  [...]
  private List&lt;string&gt; BuildAssembliesAndReturnTheirName(EnvDTE80.DTE2 dte)
  {
      Solution sln = dte.Solution;
  
      bool isDirty = false;
      foreach (Project project in sln.Projects)
      {
          VCProject vcProject = project.Object as VCProject;
          Configuration activeConfiguration = project.ConfigurationManager.ActiveConfiguration;
          foreach (VCConfiguration vcConfiguration in vcProject.Configurations)
          {
              //business logic
          }
      }
  [...]
  </code></pre>
  
  <p>A solution is opened in VS. The solution contains a few C# projects. Everything seems to be in order for this code to execute until I reach </p>
  
  <pre><code>foreach (VCConfiguration vcConfiguration in vcProject.Configurations) 
  </code></pre>
  
  <p>only to realise that this cast</p>
  
  <pre><code>VCProject vcProject = project.Object as VCProject;
  </code></pre>
  
  <p>returns null. </p>
  
  <p>Can anyone tell me why that is? I've seen <a href="https://stackoverflow.com/questions/13850291/unable-to-cast-dte-project-or-solution-to-vcproject-and-vccodemodel?answertab=oldest#tab-top">this post</a> in which <em>hveiras</em> suggests</p>
  
  <blockquote>
    <p>There is a VCCodeModel.dll for each VS version.</p>
  </blockquote>
  
  <p>If that's the case for VCProjectEngine.dll as well, how can I fix my issue?</p>
  
  <p>I have changed my reference to VCProjectEngine.dll so that it uses the one for Visual Studio 2012 (what I'm working with) but <code>vcProject</code> remains null.</p>