Programmatically open a file in Visual Studio (2010)

c#, file-io, visual-studio-2010

Solution

I believe you want one of:

- IVsUIShellOpenDocument.OpenStandardEditor

- DTE.OpenFile

- DTE.ItemOperations.OpenFile

In the end, I think they all boil down to the same behavior.

Problem

I'm building a VS package, and I'm trying to send a command from the package to Visual Studio to open up a user selected file in a new tab (just like a user would do it by going to File -> Open...). I remember seeing at some point how to do this. Can anybody refresh my memory?

Original source