Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > have GetProjectAction vstemplate to execute a recipe
 

have GetProjectAction vstemplate to execute a recipe

Hi.

I am developing a action:

Code Snippet

class AddRISProjectFromTemplate : Action

EnvDTE.DTE dte = this.GetService<ENVDTE.< FONT>DTE>(true);

Solution2 soln = (Solution2)dte.Solution;

string btsRISPrjTemplatePath;

btsRISPrjTemplatePath = soln.GetProjectTemplate("Test.BizTalkTemplate.zip", "CSharp");

the project is added to the sulution, but it is not possible to include the following section in the vstemplate file:

Code Snippet

<WizardExtension>

<Assembly>Microsoft.Practices.RecipeFramework.VisualStudio, Version=1.0.60429.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</< FONT>Assembly>

<FullClassName>Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate</< FONT>FullClassName>

</< FONT>WizardExtension>

<WizardData>

<Template xmlns="http://schemas.microsoft.com/pag/gax-template"

SchemaVersion="1.0"

Recipe="Test">

<References>

</< FONT>References>

</< FONT>Template>

</< FONT>WizardData>

This raises an error

Is there another way to have the template envoke the execution of a recipe?

Thanks for any input

Kees Wouters

Kees Wouters  Sunday, February 24, 2008 12:01 AM
Hi Kees,

are you using a custom user vstemplate for any reason? You should extract that zip file in where you have the templates and copy to the Templates folder in your guidance package solution. Remember to set the copy output as always or something like that. Then register the guidance package, that process will also register your vstemplate in Visual Studio.

hth
jose.
Jose Escrich  Thursday, February 28, 2008 11:13 AM
Which error are you getting? Please remember to post the error message every time you say you get an error otherwise is hard to guess Smile

vga  Sunday, February 24, 2008 3:32 AM

right, yea, it was a little bit late at that time.

The first error says

"Template Configuration is missing or invalid" and when you check the details of the error:

==================================

System.InvalidOperationException: Cannot find registration information for template "C:\Documents and Settings\Wouters\Application Data\Microsoft\VisualStudio\8.0\ProjectTemplatesCache\Logica.EUT.ESB.BizTalkTemplate.zip\BTSProject.vstemplate". Package templates may not be properly registered. Run package installation again and verify template name and location.
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.VSTemplatesService.GetTemplateRegistryData(String templateFileName)
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.VSTemplatesService.Microsoft.Practices.RecipeFramework.VisualStudio.Common.IVsTemplatesService.GetTemplate(String templateFileName)
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.LoadTemplateData(Dictionary`2 replacementsDictionary, String templateFileName)

====================================

The second message shows the following error:

====================================

Microsoft.Practices.RecipeFramework.ActionExecutionException: An exception occurred during the binding of reference or execution of recipe CreateISSolution. Error was: Action AddSISProjectFromTemplate failed to execute:
De bewerking is afgebroken (Exception from HRESULT: 0x80004004 (E_ABORT)).
You can remove the reference to this recipe through the Guidance Package Manager. ---> System.Runtime.InteropServices.COMException (0x80004004): De bewerking is afgebroken (Exception from HRESULT: 0x80004004 (E_ABORT))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.Interop.ThrowAbort()
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.RunStarted(Object automationObject, Dictionary`2 replacementsDictionary, WizardRunKind runKind, Object[] customParams)
at Microsoft.VisualStudio.TemplateWizard.Wizard.Execute(Object application, Int32 hwndOwner, Object[]& ContextParams, Object[]& CustomParams, wizardResult& retval)
at EnvDTE80.SolutionFolder.AddFromTemplate(String FileName, String Destination, String ProjectName)
at Logica.EUT.ESB.Actions.AddSISProjectFromTemplate.Execute() in D:\HHS\afstuderen\C_Product\VisualStudioSolution\Logica.EUT.ESB\Logica.EUT.ESB\Actions\AddSISProjectFromTemplate.cs:line 122
at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName, Dictionary`2 inputValues)
at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName)
at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionCoordinationService.Run(Dictionary`2 declaredActions, XmlElement coordinationData)
at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)
--- End of inner exception stack trace ---
at Microsoft.Practices.RecipeFramework.Recipe.UndoExecutedActionsAndRethrow(Exception ex)
at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)
at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
at Microsoft.Practices.RecipeFramework.GuidancePackage.ExecuteFromTemplate(String recipe, IDictionary arguments)
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.ExecuteRecipe(Boolean executeActions)
at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.RunFinished()

====================================

The template is:

====================================

<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>Maps</Name>
<Description>Maps</Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>Mapsd</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>__TemplateIcon.ico</Icon>
</TemplateData>
<TemplateContent>
<Project TargetFileName="BTSProject.btproj" File="BTSProject.btproj" ReplaceParameters="true">
</Project>
</TemplateContent>
<WizardExtension>
<Assembly>Microsoft.Practices.RecipeFramework.VisualStudio, Version=1.0.60429.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate</FullClassName>
</WizardExtension>
<WizardData>
<Template xmlns="http://schemas.microsoft.com/pag/gax-template"
SchemaVersion="1.0" Recipe="Test">>
<References>
</References>
</Template>
</WizardData>
</VSTemplate>

====================================

The Test.xml recipe is:

=======================================

<?xml version="1.0" encoding="utf-8" ?>

<Recipe Name="Test" xmlns="http://schemas.microsoft.com/pag/gax-core" xmlns:xi="http://www.w3.org/2001/XInclude">

<Types>

<TypeAlias Name="Evaluator" Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.ExpressionEvaluatorValueProvider,Microsoft.Practices.RecipeFramework.Library" />

</Types>

<Caption>Collects information for the new sample solution.</Caption>

<Arguments>

<Argument Name="TargetFileDummySchema">

<ValueProvider Type="Evaluator" Expression="DummySchema.xsd"></ValueProvider>

</Argument>

</Arguments>

<Actions>

<!-- werkt, t.b.v. debuggen-->

<Action Name="CreateEventLog" Type ="Logica.EUT.ESB.Actions.CreateEventLog, Logica.EUT.ESB">

<Input Name="Message" RecipeArgument="TargetFileDummySchema" />

</Action>

</Actions>

</Recipe>

=======================================

The Test recipe is included in the "main" Bindingrecipe:

</Recipe>

<xi:include href="Recipes/CreateISSolution.xml"/>

<xi:include href="Recipes/Test.xml"/>

</Recipes>

Hope you are able to point to where it goes wrong.

thanks anyway

Kees Wouters

Kees Wouters  Sunday, February 24, 2008 7:37 PM
Hi Kees,

are you using a custom user vstemplate for any reason? You should extract that zip file in where you have the templates and copy to the Templates folder in your guidance package solution. Remember to set the copy output as always or something like that. Then register the guidance package, that process will also register your vstemplate in Visual Studio.

hth
jose.
Jose Escrich  Thursday, February 28, 2008 11:13 AM

You can use google to search for other answers

Custom Search

More Threads

• CAB - Open a View from another view that exists in another or in the same module
• How to pass arguments to Action programatically?
• Error when using t4
• Problem getting project items from project (using DteHelper.FindProjectByName)
• List of Icon code
• Changing the folder of custom tool generated files
• Using EntLib with Gax/Gat
• Visual Studio 2008 Smart Client software Factory
• Can't able to run a recipe more than Once
• Passing argument between wizards (with custom TypeConverters)