Here's an alternative that works without requiring the file to be in the
project:
DTE.ExecuteCommand("File.OpenFile", sFilename)
Maybe there are better ways, but this works for me.
/Emil
> ********* <USING VS.NET 2005 BETA 1> ************
>
[quoted text clipped - 4 lines]
> ---------------------------------
> DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate()
DTE.ActiveWindow.Object.GetItem("MyAddin1\MyAddin1\Class1.cs").Select(vsUISe
lectionType.vsUISelectionTypeSelect)
> DTE.ActiveWindow.Object.DoDefaultAction
>
[quoted text clipped - 3 lines]
> THANKS
> Mark
Emil Astrom - 06 Sep 2004 18:53 GMT
One more thing: The filename should be surrounded with quotes ("), otherwise
you'll get into trouble with paths containing spaces. So maybe a better code
example would be the following:
DTE.ExecuteCommand("File.OpenFile", """" + sFilename + """")
Cheers,
Emil
> Here's an alternative that works without requiring the file to be in the
> project:
[quoted text clipped - 13 lines]
> > ---------------------------------
> > DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate()
DTE.ActiveWindow.Object.GetItem("MyAddin1\MyAddin1\Class1.cs").Select(vsUISe
> lectionType.vsUISelectionTypeSelect)
> >
[quoted text clipped - 5 lines]
> > THANKS
> > Mark
Cyril Mathey - 07 Sep 2004 20:03 GMT
Hello Mark & Emil,
Executing the File.OpenFile command works but it actually shows the editor.
If you only intend to open the document to modify it without any feedback
from the UI,
you shoud use the ProjectItem class:
EnvDTE.ProjectItem item = DTE.Solution.FindProjectItem(fileName);
item.Open(EnvDTE.Constants.vsViewKindAny);
Hope this helps.
--
Cyril
> Here's an alternative that works without requiring the file to be in the
> project:
[quoted text clipped - 24 lines]
>> THANKS
>> Mark