2. Agenda
1. Visual Studio Extensibility
2. DxAT Project For Visual Studio
3. Visual Studio Industry Partner(VSIP)
4. Guidance Automation Extension & Toolkit (GAX & GAT)
With Example
3. 1. Visual Studio Extensibility
•Visual Studio Extensibility 란 ?
•개발 방법
•개발 방법의 장단점
•DTE 란?
4. Visual Studio Extensibility – VSX 란?
• Visual Studio IDE(통합 개발 환경)의 모양과 동작을 여러 가지
방법으로 변경
• 반복적인 작업을 프로그래밍 방식으로 자동화
• 추가 기능 및 마법사와 같은 도구를 통해 Visual Studio IDE(통
합 개발 환경)를 확장
8. Visual Studio Extensibility – MACRO 개발
MACRO 방식의 개발의 장단점
• 장점
– VB 를 이용하여 빠른 개발
• Interpreter 방식으로 바로 결과 확인 가능
• 단점
– 배포의 애매함
• Script 를 굳이 Packaging 하여 배포할 필요가 있는가..??
– 소스코드 노출
– UI 생성이 불가능 ( 결국 Managed Code 로 개발된 어셈블리 필요)
9. Visual Studio Extensibility – ManagedCode 개발
Managed Code 개발의 장점
• 장점
– MACRO 방식의 단점을 수용 가능
• 단점
– Visual Studio 가 Runtime 시 Load 되므로, 초기 실행 속도 저하
13. 3. Visual Studio Industry Partner,
Visual Studio Integration Package
• Visual Studio Industry Partner (VSIP) 란?
• Visual Studio Integration Package (VSIP) 란?
14. VSIP – VSIP 란?
• Visual Studio Integration Package ?
Visual Studio Industry Partner ?
• Visual Studio 가 제공하는 Editor 나 Designer 등이 아닌, 전혀
새로운 기능이 필요할 경우
• CHM, HTML 등의 도움말이 아닌, MSDN Document 와 통합
• 새로운 프로젝트 형식이나 언어(Language) 개발
• Visual Studio 의 기능과 유사한 별도의 Tool 이 필요할때
16. 4. Guidance Automation Extension &
Toolkit (GAX & GAT)
With Example
• GAT 개념잡기
• GAT 개발하기
• GAT 예제
17. 4-1. GAT 개념잡기
• GAX 란?
• GAT 란?
• GAT 구조
• GAT 관련 용어
• 기능별 용도
18. GAT – GAX 란?
• GAX(Guidance Pacakge Extensions) 는 Guidance Package
를 실행하기 위한 Base Assemblies
• Last Version is February 2008 Release
• Download
http://www.microsoft.com/downloads/details.aspx?FamilyI
D=df79c099-4753-4a59-91e3-
5020d9714e4e&DisplayLang=en
19. GAT – GAT 란?
• GAT(Guidance Automation Toolkit) 은 Frameworks,
Components, Patterns 를 재사용하기 위한 풍부한 사용자 경
험(UX) 을 만들기 위한 아키텍처를 제공하여 Visual Studio 를
확장
– 수동적인 과정을 자동으로 재사용할 수 있도록 통합
– 반복적이고 오류가 생길 수 있는 작업을 일관되게 처리
• Last Version is February 2008 Release
• Download
http://www.microsoft.com/downloads/details.aspx?FamilyI
D=b91066b3-d1d6-4990-a45f-34cf8dbdc60c&DisplayLang=e
n
20. GAT - Position
Visual Studio SDK
Guidance Automation Extension(GAX)
Guidance Automation Toolkit(GAT)
Guidance Package
Recipe Recipe
Recipe Recipe
EntLib
Guidance
Pacakage
Recipe Recipe Recipe
21. Guidance Automation Extension ( GAX )
GAT – P&P 관계도
Smart client
Software
Factory
Web client
Software
Factory
Web Service
Software
Factory
VSTS System
Management
Model Designer
Power Tool
Custom Guidance
Package
Guidance
Automation Toolkit
Enterprise Library
Custom
Framework
23. GAT – Recipe Framework 개념
• Visual Studio 의 기능을 확장할 수 있는 Visual Studio
Package 이다
24. GAT – Recipe Framework 의 용어
• Recipe ?
– Guidance Pacakage 는 수동 또는 일련의 순차적인 행위를 자동화 한다
– 즉, 반복적인 작업을 단순화 하는 것
– 작업 단위의 묶음
• Action ?
– 순차적인 일련의 작업의 단위이다
• Argument ?
– 명시적으로 변수를 선언한다
• Value Provider ?
– Argument 로 전달되는 값을 설정하거나 초기화 한다
25. GAT – Recipe Framework 의 용어
• Bound Recipe
– Visual Studio 의 특정 element(또는 UI) 와 매핑된다
– Recipe Framework 에서 관리한다
• Unbound Recipe
– Recipe Reference 와 매핑된다
– Launch Point 를 갖기 위해 활성화 할 수 있는 조건(IsEnabledFor) 을 기
술할 수 있다.
26. Recipe
GAT – Recipe VS Family
Argument=아빠 Argument=엄마 Argument=아들 Argument=딸
ValueProvider=55 ValueProvider=50 ValueProvider=26 ValueProvider=22
Action 아빠=회사 출근
Action 엄마=가사
Action 아들=아르바이트
Action 딸=대학교
27. GAT – Recipe VS Family
건복이네 Recipe
성태네 Recipe
현정이네 Recipe
승한이네 Recipe
재두네 Recipe
철의네 Recipe
재우네 Recipe
유철이네 Recipe
준일이네 Recipe
33. GAT – Components of the Guidance Automation Toolkit
Visual Studio IDE
RecipeFramework
Wizard Framework
GAT
34. GAT – Recipe Framework
1. .NET Framework 과 Service
Containers 를 통합
2. Recipe Framework 에서 광범위
하게 사용한다
35. GAT – Recipe Framework1. 다른 컴포넌트에게 Configuration Service
를 제공
2. 이를 읽고, 증명하고, 검토한다.
3. Common Assembly 에 포함
36. GAT – Recipe Framework
1. Guidance Package 를 활성화시킨다
2. Recipe 를 관리한다
3. Template 과 Recipe의 실행을 활성/비활성
담당
37. GAT – Recipe Framework
1. Visual Studio 에 호스팅 됨
2. Recipe Framework 통합
38. GAT – Wizard Framework
1. 화면의 Wizard Page 와 필드의
구문을 해석
2. 개발자에게 자동으로 Laid-out
페이지를 보여준다
3. 필드의 값을 모은다
4. Recipe Arguments 로 필드를 결합,
Argument 로 필드값을 통과
시킨다
5. 참고 문서를 Help Button 과
연동한다
39. GAT – T4TemplatingEngine
Text Template Transformation Toolkit
1. Input / Return 할 수 있는
스크립트(VB,C# 과 유사)를 제공
2. 동적인 템플릿을 만들 수 있다
3. 대부분의 Class, XML 파일을 만들 수
있다
40. GAT – The Guidance Package Management UI1. 설치된 Guidance Package 보기
2. Guidance Package 내용 조사(Recipe, Action)
3. Guidance Package 활성/비활성
4. 사용할 수 있는 Recipe 와 Template 보기
5. Recipe 실행하기
6. Recipe Reference 삭제하기
41. GAT – The Guidance Package Management UI
1. Guidance Package 를 선택한다
2. Guidance Package 의 개략적인 정보를
보여준다
3. Recipe 와 Template 을 활성화한다
4. Recipe 와 Template 의 History 를
관리한다
5. Recipe 와 Template 을 실행Guidance Navigator
42. 4-2. GAT 개발하기
• 프로젝트 생성하기
• Guidance Package Configuration File구조
• 예제
• 개발 Tip
47. GAT – Action Element
• 하나의 Recipe 안에서의 작업의 단위
• <Actions> Element 에 정의한다
– Action 이 선언된 순서대로 실행한다
• Action 의 세가지 정의 방법
– <Actions>
• Action 을 Execution 하고, Throw 를 그대로 전달한다
– <Actions ExecutionServiceType=“Type, AssemblyName”>
• Action 이 여러 개일 경우, Throw 시 Custom Undo Process 를 실행
– <Actions CoordinatorServiceType=“Type, AssemblyName”>
• Action 을 순차적거나 반복적으로 실행할 수 있다
48. GAT – Action Element
<Action Name="UmcAction1" Type="GATTest.Actions.UmcAction1, GATTest">
<Input Name="Argument1" RecipeArgument="Argument1"/>
<Output Name="OutputArgument1" />
</Action>
namespace GATTest.Actions
{
public class UmcAction1 : Action
{
[Input] public string Argument1 { get; set; }
[Output] public string OutputArgument1 { get; set; }
public override void Execute()
{
System.Windows.Forms.MessageBox.Show("Hello Action1");
}
public override void Undo()
{
System.Windows.Forms.MessageBox.Show("Undo Action1");
}
}
}
반드시 Full ClassName 과 Assembly Name 을 명시
49. GAT – Action Element
GAT 가 제공하는 Common Actions
• TextTemplateAction
• AddItemFromStringAction
• AddProjectDependencyAction
• CreateProjectAction
• CreateUnboundReferenceAction
• GetProjectAction
• RenameProjectAction
• DoNothingAction
50. GAT – CommandBar Element
• <HostData> Element 에 포함된다
• <CommandBar> Element 는 다음과 같은 Name 값을 가질 수
있다
– Solution
– Solution Folder
– Solution Add
– Solution Folder Add
– Project
– Project Add
– Folder
– Item
– Web Project
– Web Item
– Web Folder
51. GAT – CommandBar Element
• Unbound Recipe 만 CommandBar UI 를 가질 수 있다
• Bound Recipe 는 CommandBar UI 를 가질 수 없다
54. GAT – CommandBar Element
• Unbound Recipe 의 Launch Point 를 만들려면??
<GuidancePackage xmlns="http://schemas.microsoft.com/pag/gax-core"
Name="GATTest"
Caption="GATTest"
Description="GATTest"
BindingRecipe="BindingRecipe"
Guid="0b80515e-1bad-48ba-a0ff-f301ecb03bc3"
SchemaVersion="1.0">
<Recipes>
<Recipe Name="BindingRecipe“>
<Actions>
<Action Name="UnboundRecipeSample" Type="RefCreator" AssetName="Step1"
ReferenceType="GATTest.References.AnyElementReference, GATTest" />
</Actions>
</Recipe>
<Recipe Name="Step1" Bound="false">
<HostData>
<CommandBar Name="Solution"/>
</HostData>
<Actions>
<Action Name="UmcAction1" Type="GATTest.Actions.UmcAction1, GATTest" />
</Actions>
</Recipe>
</GuidancePackage>
55. GAT – CommandBar Element
• Unbound Recipe Reference 만들려면??
[Serializable]
public class AnyElementReference : UnboundRecipeReference
{
public AnyElementReference(string recipe) : base(recipe) { }
protected AnyElementReference(SerializationInfo info, StreamingContext
context) : base(info, context) { }
public override bool IsEnabledFor(object target)
{
// Reference Launch Point(CommandBar) 가 표시될 조건
return true;
}
public override string AppliesTo
{
get { return “Guidance Automation Manager 에 표시될 적용 조건"; }
}
}
56. GAT – CommandBar Element 제한사항
• Solution Explorer(솔루션 탐색기) 에만 Command Bar 를 제공
• Hierarchy 한 구조를 가질 수 없음
• References / Web References / Service References 의
Launch Point 를 제공하지 않음
57. GAT – Gathering Arguments
• Recipe 에서 사용하는 모든 Argument 는 <Arguments> 요소
안에 정의한다
• Required Attribute 은 필수 여부를 나타낸다 ( 기본값 true )
60. GAT – Gathering Arguments – Type Converter
<Argument Name="Param1" Type="System.String">
<Converter Type="GATTest.Converters.DxFamileConverter, GATTest" />
</Argument>
public class DxFamileConverter : TypeConverter
{
public override bool IsValid(ITypeDescriptorContext context, object value)
{
// 지정된 값 개체를 이 형식에 사용할 수 있는지 여부를 반환합니다
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
// GetStandardValues에서 반환된 표준 값 컬렉션이 단독 목록인지 여부를 반환
return false;
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
// 이 개체가 목록에서 선택할 수 있는 표준 값 집합을 지원하는지 여부를 반환합니다.
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
// 데이터 형식의 표준 값 컬렉션을 반환합니다.
return new StandardValuesCollection(validValues);
}
}
Type Converter 를 이용하여 개체의 Type 변경하기
61. GAT – Gathering Arguments – Type Converter
Recipe Framework 이 제공하는 Type Converters
Microsoft.Practices.RecipeFramework.Library.Converters.CodeIdentifierStringConverter
Microsoft.Practices.RecipeFramework.Library.Converters.DteElementConverter
Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter
Microsoft.Practices.RecipeFramework.Library.Converters.ProjectConverter
Microsoft.Practices.RecipeFramework.Library.Converters.ProjectItemConverter
Microsoft.Practices.RecipeFramework.Library.Converters.ProjectItemOrEmptyConverter
Microsoft.Practices.RecipeFramework.Library.Converters.ProjectOrEmptyConverter
Microsoft.Practices.RecipeFramework.Library.Converters.ReferenceConverter
Microsoft.Practices.RecipeFramework.Library.Converters.RegexMatchStringConverter
Microsoft.Practices.RecipeFramework.Library.Converters.RegexStringNotMatchConverter
Microsoft.Practices.RecipeFramework.Library.Converters.SolutionConverter
Microsoft.Practices.RecipeFramework.Library.Converters.SolutionFolderConverter
Microsoft.Practices.RecipeFramework.Library.Converters.SolutionFolderOrEmptyConverter
Microsoft.Practices.RecipeFramework.Library.Converters.SolutionOrEmptyConverter
Microsoft.Practices.RecipeFramework.Library.Converters.WebReferenceConverter
62. GAT – Gathering Arguments – Value Provider
• Argument 의 값이 특정 개체임을 명시하여(Type Converter),
해당 Value 값을 취득
• Wizard Framework 과 연계, 초기값을 세팅
63. GAT – Gathering Arguments – Value Provider
<Argument Name="Param3" Type="DTEObject">
<Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.SolutionFolderConverter,
Microsoft.Practices.RecipeFramework.Library" />
<ValueProvider Type="GATTest.ValueProviders.SolutionValueProvider, GATTest"/>
</Argument>
public class SolutionValueProvider : ValueProvider
{
public override bool OnBeginRecipe(object currentValue, out object newValue)
{
newValue = GetService<EnvDTE.DTE>().Solution.Item(2);
return true;
}
}
64. GAT – Wizard Framework
• VSWizard Framework 를 확장한 프레임워크이다
• <GatheringServiceData> 요소 안에 정의한다
• Laid-out 형태의 UI 를 제공한다
68. GAT – Type Alias
• 미리 Type 을 지정하여 Alias 로 Type 을 지정한다
<Recipe Name="Step5">
<Types>
<TypeAlias Name="DTEObject"
Type="EnvDTE.Project, EnvDTE, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</Types>
<Arguments>
<Argument Name="Param1" Type="DTEObject">
<ValueProvider
Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.FirstSelectedProjec
t, Microsoft.Practices.RecipeFramework.Library" />
</Argument>
</Arguments>
</Recipe>
69. GAT – ETC Elements
• <xi:include>
– 다른 위치의 XML 파일을 현재의 Configuration 에 포함한다
ex) <xi:include href="TypeAlias.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
• <OverView>
– Guidance Automation Manager 의 Overview 를 표시한다
<Overview Url="http://dotnetxpert.com" />
• <DocumentationLinks>
– Recipe 의 참고 문서를 Guidance Navigator Window 에 표시하고,
NextStep 문서는 History 에서 탐색할 수 있다
ex) <DocumentationLinks>
<Link Caption="A" Url="http://a.com" Kind="Documentation"/>
<Link Caption="B" Url="http://b.com" Kind="NextStep"/>
</DocumentationLinks>
70. GAT – 개발 Tips – 디버깅 방법
1. 프로젝트 속성의 „시작 외부 프로그램‟ 을 수정한다
2. 프로젝트 속성의 „명령줄 인수‟를 수정한다
71. GAT – 개발 Tips – 디버깅 방법
1. 한번만 Register Guidance Package 를 수정한다
2. Setup Project 를 Unload 해 놓는다
3. 이후부터 Quick Register 로 빌드한다