I am new to ReSharper and was trying to write some simple plugins. I wanted to try to get full path of the file I am currently using.
Something like "C:\Proje开发者_如何学编程ct1\Firstfile.cs". If I am using "FirstFile.cs" in Visual Studio.
I was planning to show the full path as tooltip. Information of the few APIs I need to use to get the path would be helpful.
You can try the following:
public ICSharpFile CSFile = _process.ProjectFile.GetPsiFile(CSharpLanguageService.CSHARP) as ICSharpFile;
public IProjectFile ProjFile = CSFile.GetProjectFile();
Now, ProjFile.Location.ToString() should return you the complete path of your projectFile.
Good Luck!! Shaun
If you can wait for Visual Studio 11 you can use attribute CallerFilePath.
精彩评论