通过快捷键在解决方案资源管理器中使用相对路径打开文件 [英] Open a file in solution explorer with a relative path by a shortcut key
本文介绍了通过快捷键在解决方案资源管理器中使用相对路径打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用快捷键从解决方案资源管理器中选择/打开文件?
Is there a way to select/open a file from the solution explorer with a shortcut key?
在我的所有项目中,我都有一个名为 Note.txt 的文件, 可以在 Project\Info\Note.txt
中找到它.
In all my projects I have a file named Note.txt, it can be found in Project\Info\Note.txt
.
想要指定一个快捷方式,当我们点击它时,它选择并打开当前项目的 Note.txt.
Want to assign a shortcut that when we hit it, it select and open the Note.txt of the current project.
欢迎使用第 3 方工具.
Using 3rd party tools are welcome.
如果我知道如何使用工具编写宏等,那么我们可以为其设置快捷方式.
If I know how to write the macro, etc with a tool, then we can set a shortcut for it.
推荐答案
您可以在我的 中使用以下命令视觉指挥官扩展:
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
string projectFile = DTE.ActiveDocument.ProjectItem.ContainingProject.FileName;
string notePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(projectFile), @"Info\Note.txt");
DTE.ItemOperations.OpenFile(notePath);
}
这篇关于通过快捷键在解决方案资源管理器中使用相对路径打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文