Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > How can you provide input to AddProjectDependencyAction without a wizard?
 

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.

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

Paul Redman  Thursday, March 16, 2006 3:25 PM
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
kzu  Friday, March 17, 2006 3:52 AM

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

kzu  Thursday, March 23, 2006 6:10 PM
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
kzu  Friday, March 17, 2006 3:52 AM

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 creationof 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>

Paul Redman  Tuesday, March 21, 2006 6:26 PM
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.
kzu  Wednesday, March 22, 2006 5:49 PM

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>

Paul Redman  Wednesday, March 22, 2006 8:29 PM

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

kzu  Thursday, March 23, 2006 6:10 PM

You can use google to search for other answers

Custom Search

More Threads

• GAT Problem
• Including a custom assembly with GAT
• Smart Client Development - problem whit context menu i VS2005
• Problem on installing GAT
• GAT - Custom Wizard Pages
• have GetProjectAction vstemplate to execute a recipe
• Problem Using Newly Created Guidance package in VS 2005
• What happened to the GAT/GAX downloads?
• Failed to load value providers
• Simulate DependentUpon with DTE class