ValueProvider for the first selected Item in a project?

I am trying to derive a string from the currently selected item in a project.

e.g. - I have a file called "MyData.xsd" selected in the project. I would like to be able to get a handle on that item from a ValueProvider so I can get the name of it.

I see the CurrentSelectedProject ValueProvider but have not been able to find anything for CurrentSelectedItem. my first instinct was to inspect the Properties collection on the Project, but I didn't see anything useful for this situation there.

Is there already a ValueProvider that will get me that Item If not, are there any suggestions/hints as to how I might access it within my own ValueProvider



Answer this question

ValueProvider for the first selected Item in a project?

  • kosinsky

    figured it out.

    it's as simple as using an Evaluator and having these 2 arguments like this:

    <Argument Name="CurrentProject" Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

    <ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.FirstSelectedProject, Microsoft.Practices.RecipeFramework.Library" />

    </Argument>

    <Argument Name="ItemName">

    <ValueProvider Type="Evaluator" Expression="$(CurrentProject.DTE.SelectedItems.Item(1).Name)" />

    </Argument>


  • ValueProvider for the first selected Item in a project?