Title: Guidance Automation Toolkit
1Guidance Automation Toolkit
- VISUG 09/08/2006
- Jelle Druyts
- http//jelle.druyts.net
2Agenda
- Introduction
- Wizards (Recipes)
- More than just wizards
- Continuous Guidance
3Guidance Automation Toolkit
4Have you ever needed...
- A 40-page document full of guidelines
- Architectural layers
- Solution/project structure
- Namespaces, class names, method names, ...
- Best practices
- Step-by-step instructions
- Visual Studio customizations
- Custom actions
- Custom Add New items (classes, projects)
- Code generation
- Empty quick-start solutions for development teams
5Visual Studio SDK
- Visual Studio has an object model
- Call the Visual Studio APIs 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
6Guidance 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
7GAX GAT
8Guidance Automation Toolkit
9Guidance Automation Packages
- Home gt Wizards (Recipes)
- A Guidance Package consists of
- Visual Studio Templates
- Provide integration with Visual Studio
- Create New Project/Item dialog box
- Create Solutions, Projects, Project Items, ...
- Defined in .vstemplate files
- Guidance Automation Recipes
- Automated activities that define a series of
instructions - Abstract an action that the developer would need
to do manually - E.g. create projects, add references, ...
- Defined in an xml file
- Link between both Templates refer to Recipes
10Visual Studio Templates
- Home gt Wizards (Recipes)
ltVSTemplate Version"2.0" Type"ProjectGroup"
xmlns"http//schemas.microsoft.com/developer/vste
mplate/2005"gt ltTemplateDatagt
ltNamegtApplication Blocklt/Namegt
ltDescriptiongtGuidance Package that creates a new
Application Block.lt/Descriptiongt
ltProjectTypegtCSharplt/ProjectTypegt
ltIcongtApplicationBlock.icolt/Icongt
lt/TemplateDatagt ltTemplateContentgt
ltProjectCollectiongt ltProjectTemplateLink
ProjectName"ApplicationBlockNamespace.Applicat
ionBlockName"gt Projects\Runtime\Runtime.v
stemplatelt/ProjectTemplateLinkgt
lt/ProjectCollectiongt lt/TemplateContentgt
ltWizardExtensiongt ltAssemblygtMicrosoft.Practice
s.RecipeFramework.VisualStudio,
Version1.0.51206.0, Cultureneutral,
PublicKeyTokenb03f5f7f11d50a3alt/Assemblygt
ltFullClassNamegtMicrosoft.Practices.RecipeFramework
.VisualStudio.Templates.UnfoldTemplate
lt/FullClassNamegt lt/WizardExtensiongt
ltWizardDatagt ltTemplate xmlns"http//schemas.m
icrosoft.com/pag/gax-template" SchemaVersion"1.0"
Recipe"CreateApplicationBlock"gt
lt/Templategt lt/WizardDatagt lt/VSTemplategt
11Guidance Automation Recipes
- Home gt Wizards (Recipes)
ltGuidancePackage xmlns"http//schemas.microsoft.c
om/pag/gax-core" Name"JelleDruyts.EnterpriseL
ibraryGuidance" Caption"Enterprise Library
Guidance" Description"Provides guidance
around the creation of Application Blocks"
Guid"2cac5b9c-a04f-4a49-8a56-3ee5d63bd83f"
SchemaVersion"1.0"gt ltRecipesgt ltRecipe
Name"CreateApplicationBlock"gt
ltCaptiongtCreate a new Enterprise Library
Application Blocklt/Captiongt ltArgumentsgt
ltArgument Name"ApplicationBlockName"
Required"true"gt ltConverter
Type"Microsoft.Practices.RecipeFramework.Library.
Converters. CodeIdentifierStringConver
ter, Microsoft.Practices.RecipeFramework.Library"
/gt lt/Argumentgt ltArgument
Name"ApplicationBlockNamespace"
Required"true"gt ltConverter
Type"Microsoft.Practices.RecipeFramework.Library.
Converters. NamespaceStringConverter,
Microsoft.Practices.RecipeFramework.Library" /gt
lt/Argumentgt lt/Argumentsgt
ltGatheringServiceDatagt ltWizard
xmlns"http//schemas.microsoft.com/pag/gax-wizard
s" SchemaVersion"1.0"gt ltPagesgt
ltPagegt ltTitlegtApplication Block
Informationlt/Titlegt ltFieldsgt
ltField ValueName"ApplicationBlockName"
Label"Application Block Name"
InvalidValueMessage"Must be a valid .NET
identifier." /gt ltField
ValueName"ApplicationBlockNamespace"
Label"Namespace"
InvalidValueMessage"Must be a valid .NET
namespace identifier." /gt
lt/Fieldsgt lt/Pagegt lt/Pagesgt
lt/Wizardgt lt/GatheringServiceDatagt
lt/Recipegt lt/Recipesgt lt/GuidancePackagegt
12Guidance Package Wizard
- Home gt Wizards (Recipes)
13Guidance Automation Toolkit
- More than just wizards...
14Actions
- Home gt More than just wizards
- Executed 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 action
- Typically use EnvDTE
ltActionsgt ltAction Name"GetRuntimeProject"
Type"...RecipeFramework.Library.Actions.GetProjec
tAction"gt ltInput Name"ProjectName"
RecipeArgument"RuntimeProjectName" /gt
ltOutput Name"Project" /gt lt/Actiongt ltAction
Name"GetDesignTimeProject" Type"...RecipeFramewo
rk.Library.Actions.GetProjectActiongt ltInput
Name"ProjectName" RecipeArgument"DesignTimeProje
ctName" /gt ltOutput Name"Project" /gt
lt/Actiongt ltAction Name"AddProjectReference"
Type"...Library.Solution.Actions.AddProjectRefere
nceAction"gt ltInput Name"ReferringProject"
ActionOutput"GetDesignTimeProject.Project" /gt
ltInput Name"ReferencedProject"
ActionOutput"GetRuntimeProject.Project" /gt
lt/Actiongt lt/Actionsgt
15Value Providers
- Home gt More than just wizards
- Provide values for recipe arguments, optionally
dependant of other recipe arguments - Define project names, post-build commands, ...
- Retrieve currently selected project, file, ...
- Regular .NET classes (pre-built custom)
ltArgument Name"RuntimeProjectName"gt
ltValueProvider Type"Evaluator"
Expression"(ApplicationBlockNamespace).(Applica
tionBlockName)"gt ltMonitorArgument
Name"ApplicationBlockNamespace" /gt
ltMonitorArgument Name"ApplicationBlockName" /gt
lt/ValueProvidergt lt/Argumentgt
16Code Generation
- Home gt More than just wizards
- T4 templates (text templates transformation
toolkit) - E.g. generate data access component from
database, ... - ASP.NET-like syntax with full capabilities of .NET
lt_at_ template language"C" gt lt_at_ assembly
name"System.dll" gt lt_at_ property
processor"PropertyProcessor" name"TargetNamespac
e" gt lt_at_ property processor"PropertyProcessor"
name"NodeName" gt using System using
Microsoft.Practices.EnterpriseLibrary.Common.Confi
guration using Microsoft.Practices.EnterpriseLibr
ary.Configuration.Design namespace lt
this.TargetNamespace gt internal sealed
class lt this.NodeName gt ConfigurationNode
17Guidance Automation Toolkit
18Recipes stay alive
- Home gt Continuous Guidance
- The show isnt over when the initial solution has
been created - Recipes associated with project items
- Unbound / bound (to a specific item) / dynamic
- E.g. right-click data access project, choose Add
Data Access Component - Adding more templates
- New projects, e.g. data access project
- New project items, e.g. data access component
- Uses same mechanisms (wizards, actions, ...)
19Guidance Navigator
- Home gt Continuous Guidance
- Separate window listing
- Overview information
- All the available recipes
- History of executed recipes
- Links to online help, documentation, ...
20Questions?
?