在Visual Studio(2010)中以编程方式打开文件

在Visual Studio(2010)中以编程方式打开文件

问题描述:

我正在构建VS程序包,并试图从该程序包向Visual Studio发送命令,以在新选项卡中打开用户选择的文件(就像用户通过转到File来做到这一点一样->打开...).

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?

我相信您想要以下一种:

I believe you want one of:

  1. IVsUIShellOpenDocument.OpenStandardEditor
  2. DTE.OpenFile
  3. DTE.ItemOperations.OpenFile

最后,我认为他们都归结为相同的行为.

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