Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在 C# 中使用 EnvDTE 以编程方式打开文件。
假设你有一个正确的 DTE 实例的钩子......
DTE.ExecuteCommand("File.OpenFile", "c:\\derp.txt");
您可以直接在 Visual Studio 控制台中尝试以下代码段:
$DTE.ItemOperations.OpenFile("c:\derp.txt",$DTE.Constants.vsViewKindTextView)
只要文件存在,它就应该打开它......