title: Why aren't all EnvDTE assemblies Primary Interop...I'm COMfused?
body: <p>I'm trying to understand how the Visual Studio <a href="https://docs.microsoft.com/en-us/dotnet/api/envdte?view=visualstudiosdk-2017" rel="nofollow noreferrer">EnvDTE</a> Interop Assemblies work, and why they have been designed this way. New assemblies contain updated/new interfaces, and the recommendation by Microsoft is to use the most recent interface in VS2017. That looks like this:</p>
  
  <pre><code>EnvDTE.DTE dte = (EnvDTE.DTE)((IServiceProvider)Host).GetCOMService(typeof(DTE));
  EnvDTE80.DTE2 dte2 = (EnvDTE80)dte;
  EnvDTE.Solution solution = dte2.Solution; // Returns a Solution type, not Solution2
  EnvDTE80.Solution2 solution2 = (EnvDTE80.Solution2)dte2.Solution; 
  </code></pre>
  
  <p>In that snippet,the DTE2.Solution property returns type <a href="https://docs.microsoft.com/en-us/dotnet/api/envdte.solution?view=visualstudiosdk-2017" rel="nofollow noreferrer">Solution</a> and not <a href="https://docs.microsoft.com/en-us/dotnet/api/envdte80.solution2?view=visualstudiosdk-2017" rel="nofollow noreferrer">Solution2</a> as I'd have expected... You must explicitly cast to access newer interfaces, which seems odd. </p>
  
  <p>I searched the registry for each GUID of the EnvDTExxx assemblies, but the only CLSIDs I found with references to any of them were the <strong>Microsoft Visual Studio DTE Object</strong> and the <strong>Microsoft Visual Studio Solution Object</strong>. Both link to EnvDTE as their type library... And I can't find any COM object that uses the newer EnvDTExxx versions. Yet I see the newest interfaced in OleView!!! :</p>
  
  <p><a href="https://i.stack.imgur.com/lbqWt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lbqWt.png" alt="DTE2 is Available"></a></p>
  
  <p>Does this mean newer EvDTExxx Assemblies rely on the origional EnvDTE to access the actual COM component? I believe the interfaces in OleView represent the actual interfaces on the COM component... but then why wouldn't the EnvDTE type library use the updated DTE2 interface? </p>
  
  <p>To add to my confusion, I discovered only EnvDTE and EnvDTE80 are decorated with the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.primaryinteropassemblyattribute?view=netframework-4.7.2" rel="nofollow noreferrer">PrimaryInteropAssemblyAttribute</a>... while EnvDTE90-100 aren't! I'm assuming because the newer interop assemblies only expose types of EnvDTE (The PIA), there won't be type conflicts? But that doesn't explain why EnvDTE80 is marked as a PIA also...I thought there could only be one PIA! </p>
  
  <p>Please rescue me from my COMfusion! </p>