Skip to content

Commit 3b92ae2

Browse files
committed
Fixed opening non-project files
When files that weren't part of a project (added directly to a solution or open as a raw file outside the solution) were selected in the file list, a Not Implemented exception window was thrown up and VS would crash if the file was selected a second time. This catches the exception and attempts to open the file by path instead of by file reference. Fixes #6
1 parent 1ac21e9 commit 3b92ae2

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

ListFiles.xaml.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Generic;
23
using System.Collections.ObjectModel;
34
using System.IO;
45
using System.Linq;
@@ -126,8 +127,16 @@ private void OpenSelectedFiles(bool bInSolutionExplorer)
126127
{
127128
if (!bInSolutionExplorer)
128129
{
129-
var w = (item as ProjectItemWrapper).ProjItem.Open();
130-
w.Visible = true;
130+
try
131+
{
132+
var w = (item as ProjectItemWrapper).ProjItem.Open("{7651A703-06E5-11D1-8EBD-00A0C90F26EA}");
133+
w.Visible = true;
134+
}
135+
catch (Exception)
136+
{
137+
var w = OpenFileInSolutionPackage.GetActiveIDE().ItemOperations.OpenFile((item as ProjectItemWrapper).Path);
138+
w.Visible = true;
139+
}
131140
}
132141
else
133142
{

0 commit comments

Comments
 (0)