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?
Choose File -> Open -> Project/Solution.
In Visual Studio, click File > Open > Folder. Navigate to the folder, and click Select Folder. This opens the folder in Solution Explorer and displays its contents, files and any subfolders.
I believe you want one of:
In the end, I think they all boil down to the same behavior.
I like to use the DTE method ExecuteCommand("commandName") as you can test the command in the VS Command Window
In this case ExecuteCommand("File.OpenFile")
You can add parameters to the command in a second optional string parameter if you wish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With