COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

20
COB.NET R2 Program - 26 June 2022 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts http://jelle.druyts.net

Transcript of COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Page 1: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

COB.NET R2 Program - 10 April 2023

Guidance Automation Toolkit

VISUG 09/08/2006

Jelle Druytshttp://jelle.druyts.net

Page 2: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

AgendaIntroductionWizards (Recipes)More than just wizardsContinuous Guidance

Page 3: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance Automation Toolkit

Introduction

Page 4: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Have you ever needed...A 40-page document full of guidelines

Architectural layersSolution/project structureNamespaces, class names, method names, ...Best practicesStep-by-step instructions

Visual Studio customizationsCustom actionsCustom “Add New” items (classes, projects)

Code generationEmpty quick-start solutions for development

teams

Home > Introduction

Page 5: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Visual Studio SDK Visual Studio has an object model

Call the Visual Studio API’s directly EnvDTE.dll and EnvDTE80.dll

Powerful Entire Visual Studio object model is

exposed Difficult

Registering custom packages in Visual Studio

COM interop with EnvDTE object model

Home > Introduction

Page 6: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance Automation Toolkit Guidance Automation

Making reusable code and pattern assets directly available in Visual Studio 2005

Integrating reusable code into applications Guiding developers through complex procedures

Uses Visual Studio SDK behind the scenes Built and used by Microsoft Patterns &

Practices Web Service Software Factory Smart Client Software Factory Mobile Client Software Factory

Latest release: June 2006 CTP

Home > Introduction

Page 7: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

GAX & GAT

Home > Introduction

Page 8: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance Automation Toolkit

Wizards (Recipes)

Page 9: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance Automation PackagesA Guidance Package consists of

Visual Studio TemplatesProvide integration with Visual Studio

“Create New Project/Item” dialog boxCreate Solutions, Projects, Project Items, ...

Defined in .vstemplate filesGuidance Automation Recipes

Automated activities that define a series of instructionsAbstract an action that the developer would need to

do manuallyE.g. create projects, add references, ...

Defined in an xml fileLink between both: Templates refer to Recipes

Home > Wizards (Recipes)

Page 10: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Visual Studio Templates

Home > Wizards (Recipes)

<VSTemplate Version="2.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"> <TemplateData> <Name>Application Block</Name> <Description>Guidance Package that creates a new Application Block.</Description> <ProjectType>CSharp</ProjectType> <Icon>ApplicationBlock.ico</Icon> </TemplateData> <TemplateContent> <ProjectCollection> <ProjectTemplateLink ProjectName="$ApplicationBlockNamespace$.$ApplicationBlockName$"> Projects\Runtime\Runtime.vstemplate</ProjectTemplateLink> </ProjectCollection> </TemplateContent> <WizardExtension> <Assembly>Microsoft.Practices.RecipeFramework.VisualStudio, Version=1.0.51206.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="CreateApplicationBlock"> </Template> </WizardData></VSTemplate>

Page 11: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance Automation Recipes

Home > Wizards (Recipes)

<GuidancePackage xmlns="http://schemas.microsoft.com/pag/gax-core" Name="JelleDruyts.EnterpriseLibraryGuidance" Caption="Enterprise Library Guidance" Description="Provides guidance around the creation of Application Blocks" Guid="2cac5b9c-a04f-4a49-8a56-3ee5d63bd83f" SchemaVersion="1.0"> <Recipes> <Recipe Name="CreateApplicationBlock"> <Caption>Create a new Enterprise Library Application Block</Caption> <Arguments> <Argument Name="ApplicationBlockName" Required="true"> <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters. CodeIdentifierStringConverter, Microsoft.Practices.RecipeFramework.Library" /> </Argument> <Argument Name="ApplicationBlockNamespace" Required="true"> <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters. NamespaceStringConverter, Microsoft.Practices.RecipeFramework.Library" /> </Argument> </Arguments> <GatheringServiceData> <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0"> <Pages> <Page> <Title>Application Block Information</Title> <Fields> <Field ValueName="ApplicationBlockName" Label="Application Block Name" InvalidValueMessage="Must be a valid .NET identifier." /> <Field ValueName="ApplicationBlockNamespace" Label="Namespace" InvalidValueMessage="Must be a valid .NET namespace identifier." /> </Fields> </Page> </Pages> </Wizard> </GatheringServiceData> </Recipe> </Recipes></GuidancePackage>

Page 12: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance Package Wizard

Home > Wizards (Recipes)

Page 13: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance Automation Toolkit

More than just wizards...

Page 14: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

ActionsExecuted after a recipe is unfolded

E.g. add project references, generate classes, ...

Regular .NET classes (pre-built & custom)Strongly-typed input and output arguments

Come from the recipe or another actionTypically use EnvDTE

Home > More than just wizards

<Actions> <Action Name="GetRuntimeProject" Type="...RecipeFramework.Library.Actions.GetProjectAction"> <Input Name="ProjectName" RecipeArgument="RuntimeProjectName" /> <Output Name="Project" /> </Action> <Action Name="GetDesignTimeProject" Type="...RecipeFramework.Library.Actions.GetProjectAction“> <Input Name="ProjectName" RecipeArgument="DesignTimeProjectName" /> <Output Name="Project" /> </Action> <Action Name="AddProjectReference" Type="...Library.Solution.Actions.AddProjectReferenceAction"> <Input Name="ReferringProject" ActionOutput="GetDesignTimeProject.Project" /> <Input Name="ReferencedProject" ActionOutput="GetRuntimeProject.Project" /> </Action></Actions>

Page 15: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Value ProvidersProvide values for recipe arguments,

optionally dependant of other recipe argumentsDefine project names, post-build

commands, ...Retrieve currently selected project, file, ...

Regular .NET classes (pre-built & custom)

Home > More than just wizards

<Argument Name="RuntimeProjectName"> <ValueProvider Type="Evaluator" Expression="$(ApplicationBlockNamespace).$(ApplicationBlockName)"> <MonitorArgument Name="ApplicationBlockNamespace" /> <MonitorArgument Name="ApplicationBlockName" /> </ValueProvider></Argument>

Page 16: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Code GenerationT4 templates (text templates

transformation toolkit)E.g. generate data access component from

database, ...ASP.NET-like syntax with full capabilities

of .NET

Home > More than just wizards

<#@ template language="C#" #><#@ assembly name="System.dll" #><#@ property processor="PropertyProcessor" name="TargetNamespace" #><#@ property processor="PropertyProcessor" name="NodeName" #>using System;using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;using Microsoft.Practices.EnterpriseLibrary.Configuration.Design; namespace <#= this.TargetNamespace #>{ internal sealed class <#= this.NodeName #> : ConfigurationNode { }}

Page 17: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance Automation Toolkit

Continuous Guidance

Page 18: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Recipes stay aliveThe show isn’t over when the initial solution

has been createdRecipes associated with project items

Unbound / bound (to a specific item) / dynamicE.g. right-click data access project, choose “Add

Data Access Component”Adding more templates

New projects, e.g. data access projectNew project items, e.g. data access component

Uses same mechanisms (wizards, actions, ...)

Home > Continuous Guidance

Page 19: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Guidance NavigatorSeparate window listing

Overview informationAll the available recipesHistory of executed recipesLinks to online help, documentation, ...

Home > Continuous Guidance

Page 20: COB.NET R2 Program - 02 June 2014 Guidance Automation Toolkit VISUG 09/08/2006 Jelle Druyts .

Questions?