Ben Scott - Aust

I couldntfind a lot of information about this Action. I use a value provider I wrote to get the template location. The template is one I created from a simple project that I've left unchanged other than adding the WizardExtension section to the vstemplate. I just added the files to the a sub-folder of the Templates\Projects folder of my GAT solution, after unzipping the template created by visual studio.

The error message I get is:
Code Block



*) Error: 0 : Microsoft.Practices.RecipeFramework.ActionExecutionException: An exception occurred during the binding of reference or execution of recipe GenerateClassT4. Error was: Action CreateProject failed to execute:
Invalid URI: The URI is empty..
You can remove the reference to this recipe through the Guidance Package Manager. ---> System.UriFormatException: Invalid URI: The URI is empty.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Microsoft.VisualStudio.TemplateWizard.Wizard.Execute(Object application, Int32 hwndOwner, Object[]& ContextParams, Object[]& CustomParams, wizardResult& retval)
at EnvDTE.SolutionClass.AddFromTemplate(String FileName, String Destination, String ProjectName, Boolean Exclusive)
at Microsoft.Practices.RecipeFramework.Library.Actions.CreateProjectAction.Execute()
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.Execute(IAssetReference reference)
at Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()
at Microsoft.Practices.RecipeFramework.AssetReference.Execute()
at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()
at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()





My action is defined as:

Code Block

<Action Name="CreateProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.CreateProjectAction, Microsoft.Practices.RecipeFramework.Library">
<Input Name="ProjectName" RecipeArgument="ServiceName"/>
<Input Name="Template" RecipeArgument="Template"/>
<Input Name="ProjectFolder" RecipeArgument="ServiceName"/>
<Output Name="Project"/>
</Action>




And my vstemplate file is:

Code Block

<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>WCFService1</Name>
<Description>WCF Service Application for my app</Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>WCFService1</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>__TemplateIcon.ico</Icon>
</TemplateData>
<TemplateContent>
<Project TargetFileName="WCFService1.csproj" File="WCFService1.csproj" ReplaceParameters="true">
<Folder Name="App_Data" TargetFolderName="App_Data" />
<ProjectItem ReplaceParameters="true" TargetFileName="IService1.cs">IService1.cs</ProjectItem>
<Folder Name="Properties" TargetFolderName="Properties">
<ProjectItem ReplaceParameters="true" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>
</Folder>
<ProjectItem ReplaceParameters="false" TargetFileName="Service1.svc">Service1.svc</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Service1.svc.cs">Service1.svc.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Web.config">Web.config</ProjectItem>
</Project>
</TemplateContent>
<WizardExtension>
<Assembly>Microsoft.Practices.RecipeFramework.VisualStudio, Version=1.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate</FullClassName>
</WizardExtension>
</VSTemplate>



It seems from the error that its more likely to be something wrong with my template. I've confirmed that the Template argument has a correct path to my template. Does the project folder need to exist/be created Or is that created by the action I've confirmed that all the files mentioned in the template exist where the template is. I'm not sure what URI its talking about.

I just wanted to get a basic plain project creation going, before making changes, so I havnt touched any of the files involved yet.

Does anyone have any idea what might be wrong


Re: Visual Studio Guidance Automation Toolkit Error using CreateProjectAction - Invalid URI: The URI is empty..

Jose Escrich

What's the value of the Template argument.

It should be absolute or relative to the Templates folder, ie: "Items\MyClass.vstemplate"

when in the project that .vstemplate file will be in MyGuidancePackage\Templates\Items\MyClass.vstemplate.

hth.

jose.






Re: Visual Studio Guidance Automation Toolkit Error using CreateProjectAction - Invalid URI: The URI is empty..

Ben Scott - Aust

The Template argument contains an absolute path to the template (I'd read stuff that said it had to be absolute, not relative).

I debugged the value provider that provided the argument and copy/pasted the path into windows explorer and it openned up to the correct directory, and I've double checked the spelling of my template file.

"D:\\Projects\\V1\\MyGenerator\\ServiceGenerator\\bin\\Debug\\Templates\\Projects\\WCFServiceApp\\MyTemplate.vstemplate"




Re: Visual Studio Guidance Automation Toolkit Error using CreateProjectAction - Invalid URI: The URI is empty..

Jose Escrich

Hi Ben

If that template is a Project you should specify the DestinationFolder using a full path where you want to place it.

hth.

jose.






Re: Visual Studio Guidance Automation Toolkit Error using CreateProjectAction - Invalid URI: The URI is empty..

Ben Scott - Aust

Thanks Jose,

That was it. Fixed now!






Re: Visual Studio Guidance Automation Toolkit Error using CreateProjectAction - Invalid URI: The URI is empty..

Ben Scott - Aust

Hi there,

I've now run into a further problem. I'm creating my project fine, but when I try to add classes (generated from T4 templates) I get an error that the Project output from my create action is null or empty. "Argument can not be null or have an empty value.
Parameter name: Project."

Heres the actions:
Code Block

<Actions>
<Action Name="CreateInterfaceProject" Type="Microsoft.Practices.RecipeFramework.Library.Actions.CreateProjectAction, Microsoft.Practices.RecipeFramework.Library">
<Input Name="ProjectName" RecipeArgument="InterfaceProjectName"/>
<Input Name="Template" RecipeArgument="LibraryTemplate"/>
<Input Name="ProjectFolder" RecipeArgument="InterfaceProjectPath"/>
<Output Name="Project"/>
</Action>
<Action Name="GenerateServiceContractClass" Type="Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TextTemplateAction, Microsoft.Practices.RecipeFramework.VisualStudio.Library"
Template="Text\ServiceContract.cs.t4" >
<Input Name="ServiceName" RecipeArgument="ServiceName" />
<Input Name="TargetNamespace" RecipeArgument="TargetNamespace" />
<Input Name="ServiceContractNamespace" RecipeArgument="ServiceContractNamespace" />
<Input Name="Filename" RecipeArgument="XMLFileName"/>
<Output Name="Content" />
</Action>
<Action Name="AddServiceContractClass" Type="Microsoft.Practices.RecipeFramework.Library.Actions.AddItemFromStringAction, Microsoft.Practices.RecipeFramework.Library"
Open="true">
<Input Name="Content" ActionOutput="GenerateServiceContractClass.Content" />
<Input Name="TargetFileName" RecipeArgument="ServiceContractTargetFile" />
<Input Name="Project" ActionOutput="CreateInterfaceProject.Project" />
</Action>


I cant see why it would think that argument is empty, when it should be populated from the create project action. The project is being created successfully.


Also while I'm at it. For now I'm just creating my projects (I create 3 each time the recipe runs) under the solution, however I'd like to create a solution folder and create them under that folder. I already create them physically (on the HD) under a folder under the solution folder, however I'd like to reflect that under the solution explorer also (hope that makes sense). Can I do that with the CreateProjectAction




Re: Visual Studio Guidance Automation Toolkit Error using CreateProjectAction - Invalid URI: The URI is empty..

Jose Escrich

Is strange, what's the parent where're you're unfolding the template

Regarding the SolutionFolder, you should create it, before try to unfold the project otherwise it won't be created.

jose.






Re: Visual Studio Guidance Automation Toolkit Error using CreateProjectAction - Invalid URI: The URI is empty..

Ben Scott - Aust

It just creates it under the open Solution. Thats one reason I was asking about solution folders, I couldnt see how I could get it to create it anywhere else (in the solution, I can set the physical path wherever I want).