0

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:\Project1\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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sachin
  • 155
  • 1
  • 8

2 Answers2

0

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

Shaun
  • 199
  • 1
  • 10
0

If you can wait for Visual Studio 11 you can use attribute CallerFilePath.

brgerner
  • 4,287
  • 4
  • 23
  • 38