title: How to handle loading of specific file type in Visual Studio extension
body: <p>I have a Visual Studio solution inside a zip file and my plan is to unzip that file and then load the solution. Is it possible to do this with the Visual Studio API?</p>
  
  <p>My first thought was to to implement <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivsprojectfactory?view=visualstudiosdk-2017" rel="nofollow noreferrer">IVsProjectFactory</a> and <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivsprojectupgradeviafactory?redirectedfrom=MSDN&amp;view=visualstudiosdk-2017" rel="nofollow noreferrer">IVsProjectUpgradeViaFactory</a> to unzip the solution in the <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivsprojectfactory.createproject?view=visualstudiosdk-2017#Microsoft_VisualStudio_Shell_Interop_IVsProjectFactory_CreateProject_System_String_System_String_System_String_System_UInt32_System_Guid__System_IntPtr__System_Int32__" rel="nofollow noreferrer">CreateProject</a>/<a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivsprojectupgradeviafactory.upgradeproject?view=visualstudiosdk-2017#Microsoft_VisualStudio_Shell_Interop_IVsProjectUpgradeViaFactory_UpgradeProject_System_String_System_UInt32_System_String_System_String__Microsoft_VisualStudio_Shell_Interop_IVsUpgradeLogger_System_Int32__System_Guid__" rel="nofollow noreferrer">UpgradeProject</a> method and then load it. </p>
  
  <p>Unzipping works, but when I try to load the solution file with <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivssolution.opensolutionfile?view=visualstudiosdk-2017#Microsoft_VisualStudio_Shell_Interop_IVsSolution_OpenSolutionFile_System_UInt32_System_String_" rel="nofollow noreferrer">IVsSolution.OpenSolutionFile()</a> or <a href="https://docs.microsoft.com/en-us/dotnet/api/envdte.solutionclass.open?view=visualstudiosdk-2017#EnvDTE_SolutionClass_Open_System_String_" rel="nofollow noreferrer">DTE.Solution.Open()</a> (inside the CreateProject/UpgradeProject method), it fails with an ArgumentException.</p>
  
  <p>Is there any solution to this problem? Ideally, it should behave just like opening a normal VS Solution (opening from Windows explorer, or Ctrl+o/Ctrl+Shift+o in Visual Studio).</p>
  
  <p><strong>Edit</strong>
  I have managed to get it working by implementing an <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivseditorfactory?view=visualstudiosdk-2017" rel="nofollow noreferrer">IVsEditorFactory</a> which is associated with my file extension. When a file with that extension is opened, the <a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.ivseditorfactory.createeditorinstance?view=visualstudiosdk-2017#Microsoft_VisualStudio_Shell_Interop_IVsEditorFactory_CreateEditorInstance_System_UInt32_System_String_System_String_Microsoft_VisualStudio_Shell_Interop_IVsHierarchy_System_UInt32_System_IntPtr_System_IntPtr__System_IntPtr__System_String__System_Guid__System_Int32__" rel="nofollow noreferrer">CreateEditorInstance</a> method is called where I unzip the file and then open the solution with IVsSolution.OpenSolutionFile().</p>
  
  <p>Unfortunately, this does not allow me to open the file via File->Open->Project/Solution, but only via File->Open->File. Also, the dialog that shows up when opening the file is titled "Opening the file" not "opening the solution" or something like that.</p>
  
  <p>This solution feels a bit like a hack, but until now I couldn't find another way. I'm still open for better solutions.</p>