title: Visual Studio Extension: Get the path of the current selected file in the Solution Explorer
body: <p>I'm trying to create my first extension for visual studio and so far I've been following this tutorial to get me started (<a href="http://www.diaryofaninja.com/blog/2014/02/18/who-said-building-visual-studio-extensions-was-hard" rel="nofollow noreferrer">http://www.diaryofaninja.com/blog/2014/02/18/who-said-building-visual-studio-extensions-was-hard</a>).
  Now I have a custom menu item appearing when I click on a file in the solution explorer. 
  What I need now for my small project is to get the path of the file selected in the solution explorer but I can't understand how can I do that.
  Any help?</p>
  
  <p>---------------------------- EDIT ------------------------------</p>
  
  <p>As matze said, the answer is in the link I posted. I just didn't notice it when I wrote it.
  In the meanwhile I also found another possible answer in this thread: <a href="https://stackoverflow.com/questions/13194880/how-to-get-the-details-of-the-selected-item-in-solution-explorer-using-vs-packag">How to get the details of the selected item in solution explorer using vs package</a></p>
  
  <p>where I found this code:</p>
  
  <pre><code>foreach (UIHierarchyItem selItem in selectedItems)
              {
                  ProjectItem prjItem = selItem.Object as ProjectItem;
                  string filePath = prjItem.Properties.Item("FullPath").Value.ToString();
                  //System.Windows.Forms.MessageBox.Show(selItem.Name + filePath);
                  return filePath;
              }
  </code></pre>
  
  <p>So, here are two ways to get the path to the selected file(s) :)</p>