How can you provide input to AddProjectDependencyAction without a wizard?

I would like to use the AddProjectDependencyAction but I do not want to gather the project input information from the user through a wizard.  I am able to derive the project names as strings in the recipe but the Action wants EnvDTE.Project types as input.  I attempted to use the ProjectConverter but have been unsuccessful.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Is it possible to convert a string argument into a EnvDTE.Project Argument and then pass that to the AddProjectDependencyAction



Answer this question

How can you provide input to AddProjectDependencyAction without a wizard?

  • Predicator

    Thank you for the post. I have attempted to do as you suggested and came up with the following xml statement in my Recipe. This generates an error that states the value is not valid. I have a project in the root folder of the solution named "PostBuild". This is running during the creation of the solution.

    Any assistance would be greatly appreciated,

    thanks,

    Paul

    <Argument Name="PostBuildProject" Type="EnvDTE.Project, EnvDTE">

    <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.ProjectConverter, Microsoft.Practices.RecipeFramework.Library"/>

    <ValueProvider Type="Evaluator" Expression="\PostBuild" />

    </Argument>


  • natwdw1

    Can you also share the .vstemplate file I don't undestand if PostBuild is the name of your solution, your project or a solution folder.


  • Netenrich

    You can pass the hardcoded string using a value provider, and use the ProjectConverter class. This class converts a "virtual" path to a project relative to the solution root, as in \MyFolder\MyProject, into the corresponding project instance.

    HTH


  • Avnerm

    Here is the TemplateContent section of the .vstemplate file for the solution. PostBuild is one of the projects within the solution.

    I have attempted to use the following values in the ValueProvider as well. None of them produce a successful result.

    "\PostBuild\PostBuild", "\Solution\PostBuild\PostBuild", "\PostBuild\PostBuild.csproj", "\Solution\PostBuild\PostBuild.proj".

    thanks,

    Paul

    ---

    <TemplateContent>

    <ProjectCollection>

    <SolutionFolder Name="Solution">

    <SolutionFolder Name="ApplicationArchitecture">

    <ProjectTemplateLink ProjectName="$RootNamespace$.DataEntityModel">Projects\CompanyX.GroupX.ProjectX.DataEntityModel\CompanyX.GroupX.ProjectX.DataEntityModel.vstemplate</ProjectTemplateLink>

    <ProjectTemplateLink ProjectName="$RootNamespace$.Service.Library">Projects\CompanyX.GroupX.ProjectX.Service.Library\CompanyX.GroupX.ProjectX.Service.Library.vstemplate</ProjectTemplateLink>

    <ProjectTemplateLink ProjectName="$RootNamespace$.ServiceAgent">Projects\CompanyX.GroupX.ProjectX.ServiceAgent\CompanyX.GroupX.ProjectX.ServiceAgent.vstemplate</ProjectTemplateLink>

    <ProjectTemplateLink ProjectName="$RootNamespace$.Service">Projects\CompanyX.GroupX.ProjectX.Service\CompanyX.GroupX.ProjectX.Service.vstemplate</ProjectTemplateLink>

    <ProjectTemplateLink ProjectName="$RootNamespace$.WebApp">Projects\CompanyX.GroupX.ProjectX.WebApp\CompanyX.GroupX.ProjectX.WebApp.vstemplate</ProjectTemplateLink>

    </SolutionFolder>

    <SolutionFolder Name="TechnicalArchitecture">

    <ProjectTemplateLink ProjectName="$CompanyX$.Architecture">Projects\CompanyX.Architecture\CompanyX.Architecture.vstemplate</ProjectTemplateLink>

    <ProjectTemplateLink ProjectName="$CompanyX$.Architecture.Test">Projects\CompanyX.Architecture.Test\CompanyX.Architecture.Test.vstemplate</ProjectTemplateLink>

    <ProjectTemplateLink ProjectName="$CompanyX$.Architecture.Service.Library">Projects\CompanyX.Architecture.Service.Library\CompanyX.Architecture.Service.Library.vstemplate</ProjectTemplateLink>

    <ProjectTemplateLink ProjectName="$CompanyX$.Architecture.Service.Library.Test">Projects\CompanyX.Architecture.Service.Library.Test\CompanyX.Architecture.Service.Library.Test.vstemplate</ProjectTemplateLink>

    <ProjectTemplateLink ProjectName="$CompanyX$.Architecture.Service">Projects\CompanyX.Architecture.Service\CompanyX.Architecture.Service.vstemplate</ProjectTemplateLink>

    </SolutionFolder>

    <ProjectTemplateLink ProjectName="PostBuild">Projects\PostBuild\PostBuild.vstemplate</ProjectTemplateLink>

    </SolutionFolder>

    </ProjectCollection>

    </TemplateContent>


  • aggietech

    Solution\PostBuild

    That's the value you have to use (apparently you didn't try that particular one ).

    As I said, the converter takes the virtual path to an item as it appears in the solution explorer, basically concatenating all node names with a path separator. A project looks in the solution explorer with a name, not with the .csproj extension. The easiest way to find out which string to use is to unfold the template once, look at the resulting solution, and do that concatenation manually to build the string.

    HTH



  • How can you provide input to AddProjectDependencyAction without a wizard?