A deep dive into the guidance automation toolkit
1 / 41

A Deep Dive Into The Guidance Automation Toolkit - PowerPoint PPT Presentation

  • Uploaded on

A Deep Dive Into The Guidance Automation Toolkit. Jelle Druyts Compuware .NET Consultant http://jelle.druyts.net. Have you ever needed. A 40-page document full of guidelines Architectural layers, solution/project structure Namespaces, class names, method names, ...

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' A Deep Dive Into The Guidance Automation Toolkit' - elijah-hunter

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
A deep dive into the guidance automation toolkit

A Deep Dive Into TheGuidance Automation Toolkit

Jelle Druyts

Compuware .NET Consultant


Have you ever needed
Have 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, menu items, toolbar buttons, ...

    • Custom “Add New” items (classes, projects, solutions)

  • Advanced automation

    • Wizards

    • Code generation

    • Quick-start solutions for development teams

    • Custom Software Factory development

  • More time to write interesting code?


  • You will learn

    • What GAT is, what it can and cannot do

    • Best practices for GAT development

    • How GAT fits into the Software Factories vision

  • You will be able to

    • Recognize opportunities for GAT

    • Implement solutions with GAT

    • Sit back while it does your work


  • Visual Studio Extensibility

  • Guidance Automation Toolkit

  • GAT Best Practices

  • GAT & Software Factories

Visual studio templates
Visual Studio Templates Studio

  • Project & Item templates

    • Reusable and customizable project and item stubs

    • “New Project” and “Add New Item” dialog boxes

    • Accelerate the development process

  • Easy deployment: just a .zip file

    • Content files: source code files, embedded resources, project files, ...

    • Metadata stored in a “.vstemplate” file (XML)

    • Copy to a predefined folder (local or on the network)

  • Capabilities are limited (templates are “dumb”)

Visual studio sdk
Visual Studio SDK Studio

  • Visual Studio has an object model

    • Call the Visual Studio API’s directly

    • Use 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

Guidance automation toolkit
Guidance Automation Toolkit Studio

  • Guidance Automation

    • Make reusable code and pattern assets available in Visual Studio

    • Integrate reusable code into applications

    • Guide developers through complex procedures

    • Built upon Visual Studio SDK

  • Roadmap

    • Latest release: February 2007 CTP

    • Will be included in a future release of the Visual Studio

  • Built and used by Microsoft patterns & practices

    • Used extensively in their various “Software Factories”

  • Free download (source code not available)

Guidance automation toolkit1

A deep dive into the various elements of GAT Studio

Guidance Automation Toolkit

Gat gax
GAT & GAX Studio

Guidance automation packages
Guidance Automation Packages Studio

  • A Guidance Package is

    • Authored for a specific purpose

    • A unit of deployment and versioning

  • A Guidance Package consists of

    • Visual Studio Templates

    • Guidance Automation Recipes

  • The “Guidance Package” meta package

    • A quick-start solution for Guidance Packages

    • Generates project structure & sample code

    • Generates setup project to build MSI

Visual studio templates1
Visual Studio Templates Studio

  • Provide integration with Visual Studio

    • “Create New Project/Item” dialog box

    • Defined in .vstemplate files (XML)

    • Expanded by the Visual Studio template engine

  • Associate Visual Studio Templates with recipes

Visual studio templates2
Visual Studio Templates Studio

<VSTemplate Version="2.0" Type="ProjectGroup"



<Name>Application Block</Name>

<Description>Guidance Package that creates a new Application Block.</Description>






<ProjectTemplateLink ProjectName="$ApplicationBlockNamespace$.$ApplicationBlockName$">





<Assembly>Microsoft.Practices.RecipeFramework.VisualStudio, Version=1.0.51206.0,

Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>





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





Guidance automation recipes
Guidance Automation Recipes Studio

  • A recipe is a fancy word for a wizard

    • Automated activity as a series of instructions

    • Abstracts something a developer would need to do manually

      • E.g. create projects, add references, ...

    • Ensures that repetitive (error-prone) activities are performed in a consistent manner

    • Simplifies complex or repetitive development tasks

  • Defined in an XML file in the root of the project

  • Referenced by a Visual Studio Template

    • Recipe gets run when template is “unfolded”

Guidance automation recipes1
Guidance Automation Recipes Studio

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


<Recipe Name="CreateApplicationBlock">

<Caption>Create a new Enterprise Library Application Block</Caption>


<Argument Name="ApplicationBlockName" Required="true">


CodeIdentifierStringConverter, Microsoft.Practices.RecipeFramework.Library" />


<Argument Name="ApplicationBlockNamespace" Required="true">

<Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.

NamespaceStringConverter,Microsoft.Practices.RecipeFramework.Library" />




<Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">



<Title>Application Block Information</Title>


<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." />









Wizards Studio

  • Value gathering strategies

    • Gather values for recipe arguments

    • Walk the developer through one or more steps

  • Any recipe can have a wizard associated with it

Value providers
Value Providers Studio

  • Provide values for recipe arguments

    • Optionally dependant of other recipe arguments

    • Define project names, post-build commands, ...

    • Retrieve currently selected project, file, ...

  • Special guest: ExpressionEvaluatorValueProvider

  • Regular .NET classes (pre-built & custom)

<Argument Name="RuntimeProjectName">

<ValueProvider Type="Evaluator"


<MonitorArgument Name="ApplicationBlockNamespace" />

<MonitorArgument Name="ApplicationBlockName" />



Type converters
Type Converters Studio

  • Validate the value of a field

    • CodeIdentifierStringConverter

    • NamespaceStringConverter

    • ...

  • Convert UI fields to a type representation

  • Regular .NET classes (pre-built & custom)

<Argument Name="ApplicationBlockName" Required="true">



Microsoft.Practices.RecipeFramework.Library" />


Actions Studio

  • Atomic units of work called in a defined sequence by recipes

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

  • Strongly-typed input and output arguments

    • Come from the recipe or from another action (chaining)

  • Typically use EnvDTE

  • Regular .NET classes (pre-built & custom)


<Action Name="GetRuntimeProject" Type="...RecipeFramework.Library.Actions.GetProjectAction">

<Input Name="ProjectName" RecipeArgument="RuntimeProjectName" />

<Output Name="Project" />


<Action Name="GetDesignTimeProject" Type="...RecipeFramework.Library.Actions.GetProjectAction">

<Input Name="ProjectName" RecipeArgument="DesignTimeProjectName" />

<Output Name="Project" />


<Action Name="AddProjectReference" Type="...Library.Solution.Actions.AddProjectReferenceAction">

<Input Name="ReferringProject" ActionOutput="GetDesignTimeProject.Project" />

<Input Name="ReferencedProject" ActionOutput="GetRuntimeProject.Project" />



Code generation
Code Generation Studio

  • T4 templates (Text Templates Transformation Toolkit)

    • Combination of text and scriptlets (C#/VB.NET expressions)

    • E.g. generate data access component from database, ...

  • ASP.NET-like syntax with full capabilities of .NET

<#@ 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




Continuous guidance
Continuous Guidance Studio

  • Recipes stay “alive”

    • Recipes associated with project items

      • 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, ...)

Guidance navigator
Guidance Navigator Studio

  • Separate window listing

    • Overview information

    • All the available recipes

    • History of executed recipes

    • Links to online help, documentation, ...

Other gat artifacts
Other GAT Artifacts Studio

  • Custom Wizard Pages

    • Add custom user controls to the wizard

  • Type Editors

    • Edit values in a wizard through a custom UI

  • Snippets

    • Visual Studio snippets that are automatically deployed

When not to use gat
When (Not) To Use GAT Studio

  • Use GAT when

    • You have a specific problem with a specific solution that

      • Is automatable

      • Must be executed multiple times

      • Has a development time or risk that is too high to do manually

    • You can’t use “dumb” Visual Studio Templates

    • You want to prepare for building a Software Factory

  • Do not use GAT when

    • You will use the Guidance Package only once – ever

    • You can’t/don’t want to invest time in the learning curve

    • You just think it’s cool

Authoring guidance packages
Authoring Guidance Packages Studio

  • There is a learning curve

    • Do not involve everyone

    • Make 1 person/team responsible for GAT

    • Once the knowledge is there, investment pays off quickly

  • Don’t try to build everything at once

    • Start automating simple scenarios

    • Incrementally increase complexity

    • Add templates, logic and guidance along the way

Gat source control
GAT & Source Control Studio

  • Guidance Package “state” is kept in a .gpState file (XML) with the solution file (.sln)

    • Indicates which Guidance Packages are associated with the solution

    • Contains recipe references and some state

    • Can/should be checked in to Source Control

Guidance package state
Guidance Package State Studio

  • Guidance Packages are “stateless”

  • Recipe arguments (wizard fields) aren’t available after the wizard finished

    • Store values out-of-band (e.g. to disk, database, ...)

    • Lookup values dynamically in solution if possible (through Visual Studio SDK, e.g. default namespace)

  • The generated code is the “model”

    • DSLs can fill this gap

Gat software factories

A look at the big picture Studio

GAT & Software Factories

Software factories
Software Factories Studio

  • Initiative developed by Microsoft patterns & practices

    Web Service SF - Web Client SF

    Smart Client SF - Mobile Client SF

  • Current state: infancy

    • Written documentation + Guidance Packages + Reference Implementations

    • GAT mostly used for wizards & code generation

    • The code is the “model”

  • The road ahead: towards the Grand Vision

    • Domain Specific Languages (DSLs) capture and persist the model

    • Programming code becomes a “rendering” of the model

    • GAT guides developers through complex tasks

Gat software factories1
GAT & Software Factories Studio

  • Software Factory enabling technologies:

    • Visual Studio Extensibility Model

    • Visual Studio Modeling Tools (Designers)

    • Domain Specific Language Tools (DSLs)

      • Small, highly focused languages that model and solve clearly identifiable problems

    • Guidance Automation Toolkit

      • Generate initial solution structure

      • Wizards & code generation

      • Can be used to provide guidance and context to DSLs

        • Launch recipes from shapes in the DSLs

        • Enable DSLs in certain parts of the solution

In closing

Wrapping up... Studio

In Closing

Key points
Key Points Studio

  • GAT is the next step in Visual Studio automation

    • Builds on Visual Studio Templates & Visual Studio SDK

  • GAT can help you

    • Automate repetitive tasks and complex processes

    • Provide guidance right inside the Visual Studio solution

    • Generate code with the powerful T4 engine

    • Provide context and guidance continuously

    • Make sure guidelines and best practices are enforced

    • Be lazy 

  • GAT is a key part of Software Factories

    • Understand the present

    • Prepare for the future

Resources Studio

  • Guidance Automation Toolkit

    • Home - http://msdn.microsoft.com/vstudio/teamsystem/workshop/gat/

    • Forum - http://forums.microsoft.com/msdn/showforum.aspx?forumid=78&siteid=1

    • Community site - http://www.guidanceautomation.net/cs/default.aspx

    • My Guidance Automation series - http://jelle.druyts.net/CategoryView.aspx?category=Blog|Programming|.NET|GuidanceAutomation

  • Software Factories

    • Home - http://msdn2.microsoft.com/en-us/teamsystem/aa718951.aspx

    • Guidance Automation Toolkit and Domain-Specific Language Tools for Visual Studio 2005: Integration Scenarios -http://msdn2.microsoft.com/en-us/library/aa905334.aspx

    • EFx - http://msdn2.microsoft.com/en-us/library/aa905331.aspx

    • Clarius Software Factories Toolkit - http://softwarefactoriestoolkit.net/

  • Microsoft

    • Microsoft patterns & practices: http://msdn.microsoft.com/practices/

    • Enterprise Library 2.0: http://msdn.microsoft.com/library/en-us/dnpag2/html/EntLib2.asp

Thank you
Thank You! Studio

  • Thanks for your attention

  • I'll be happy to answer all your questions

    • Right after the session

    • Compuware Booth

    • Community Booth: Ask-The-Experts

    • VISUG Booth