Pablo Galiano :

Subscriptions

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

News

Subscribe to Pablo Galiano by Email

Post Categories

GAT (RSS)

T4 Editor is OUT!!!

As Victor announced it, the T4 Editor was released to the community. Of course you know that this is a *must have* tool if you work with GAX / DSL or Software Factories.

It currently supports VS 2005 and VS 2008 beta 2 with IntelliSense, syntax coloring and most of the fancy stuff that the editors in VS have.

Go and donwload it. :)

 

Pablo

posted Thursday, October 18, 2007 5:39 AM by pga with 0 Comments

Creating and deploying solution item templates

A solution item template is an VS item template that is available at the Solution level.

scn1

The list of item templates that you see on the Add New Item dialog is constructed by VS by looking for installed templates on certain locations.

There are two types of templates:

  • Installed Templates
    • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\Language\Locale\

  • Custom Templates 
    • My Documents\Visual Studio 2005\Templates\ItemTemplates\Language\

scn5

The location for the custom templates can be modified:

scn4

So lets see again the locations:

  • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\Language\Locale\

  • My Documents\Visual Studio 2005\Templates\ItemTemplates\Language\

The problem is that for a solution item template we DON'T have a language, there is no project that act as a container because we want to add the item directly to the solution.

So how we can create and deploy a solution template? The answer is by using the General category:

  • <VisualStudioInstallDir>\Common7\IDE\ItemTemplates\General\Locale\

  • My Documents\Visual Studio 2005\Templates\ItemTemplates\General\

And the same category for the ProjectType node in the vstemplate file:

<VSTemplate Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Item">
  <TemplateData>
    <DefaultName>Class1.cs</DefaultName>
    <Name>MyClass</Name>
    <Description>My Item Template</Description>
    <ProjectType>General</ProjectType>
    <SortOrder>10</SortOrder>
    <Icon>MyClass.ico</Icon>
  </TemplateData>
  <TemplateContent>
    <References />
    <ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">Class1.cs</ProjectItem>
  </TemplateContent>
</VSTemplate>

Pablo

posted Thursday, October 04, 2007 9:19 PM by pga with 6 Comments

The /RANU switch

The Run as Normal User (RANU) switch is part of the VS 2008  since beta 1. Aaron and Deepankar already blogged about this a couple of months ago.

In the context of VSX, RANU basically means "load my Vs Package registration information from HKCU instead of HKLM hive", or:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0Exp\Configuration

Instead of:

HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0

As pointed by Aaron, this is only for development scenarios. Package deployment is still under the HKLM hive and you will need Administrator privileges.

To support the HKCU hive and the RANU switch several tools where modified:

  • devenv.exe itself
  • RegPkg.exe or the package registration tool
  • VSRegEx.exe or the reset experimental hive tool

This is the default VSX package registration method no matter which OS is used on the development machine. The VS SDK shortcuts and VSX package project templates had been updated to reflect this registration method.

The RANU switch is only applicable for the experimental hive, so if for some specific reason we want to register a package on the normal hive on our development environment, we need to manually edit the csproj file and add the following lines:

<PropertyGroup>
  <TargetRegistryRoot>Software\Microsoft\VisualStudio\9.0</TargetRegistryRoot>
  <RegisterWithRanu>false</RegisterWithRanu>
</PropertyGroup>

Of course if you need to integrate a GAX guidance package with a VSX package (for ex a DSL) you should take this into account. You basically need to register the GP on the Exp hive with the RANU switch.

 

Pablo

posted Monday, October 01, 2007 7:20 PM by pga with 0 Comments

VS 2008 and GAX

GAX July 2007 CTP is out. It includes the following improvements:

  • Support for Visual Studio 2008 Beta 2
  • Wix based setup project template
  • Support for registration on VS experimental hive
  • You can read Tom's post to find out the details. :)

    Dowload it from here.

    Pablo

    posted Saturday, August 04, 2007 9:48 AM by pga with 2 Comments

    The real type behind a System.__ComObject

    Carlos posted some time ago a really interesting article on how to find the real object type behind a System.__ComObject. The .Object property of many classes of the Visual Studio Automation model returns this System.__ComObject type.

    This is really useful and can save a lot of time when you need to debug your VSX Package or GAT Package. As Carlos pointed out you will need to add a reference to the Microsoft.VisualBasic.dll assembly, if you develop using the C# language you can remove this reference after you finished with the development.

     

    Pablo

    posted Tuesday, July 03, 2007 10:24 AM by pga with 0 Comments

    Dealing with DTE properties collections

    There are a bunch of DTE classes that expose a Properties collection property such as:

  • EnvDTE.Project.Properties
  • EnvDTE.ProjectItem.Properties
  • EnvDTE.Configuration.Properties

    The properties collection are not typed because they depend on the project type, language and so on. Unfortunately there is no documentation in the MSDN for the list of collection property names.

    So you basically end up doing something like this:

        public void GetPropertyValues(EnvDTE.Properties properties)

        {

            foreach(EnvDTE.Property property in properties)

            {

                try

                {

                    Debug.WriteLine(

                        string.Format("Property Name: {0} - Property Value: {1}",

                            property.Name, property.Value.ToString));

                }

                catch

                {

                }

            }

        }

    And once you find the one that you want, you do:

    ProjectItem.Properties.Item("PropertyName").Value ...

    But with the help of Reflector you can reflect the following interfaces to get a list of property names:

    For project item properties:

  • VSLangProj.FileProperties
  • VSLangProj.FolderProperties
  • VSLangProj80.FileProperties2
  • VSLangProj80.FolderProperties2

    For project properties:

  • VSLangProj.ProjectProperties
  • VSLangProj2.ProjectProperties2
  • VSLangProj80.ProjectProperties3
  • VSLangProj.ProjectConfigurationProperties
  • VSLangProj2.ProjectConfigurationProperties2
  • VSLangProj80.ProjectConfigurationProperties3

    Pablo

  • posted Wednesday, June 06, 2007 9:10 AM by pga with 3 Comments

    Find any VS command GUID:ID pair

    VS SP1 introduced a really useful feature that will allow us to find any command GUID:ID pair.

    To enable the feature we need to:

    • Add the following registry information
    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\General]
    "EnableVSIPLogging"=dword:00000001
    • Open a new instance of VS

    Example usage:

    Suppose that you want to find the GUID:ID pair of the File\Open menu item:

    1. Click on the File menu
    2. Hover the mouse over the Open sub menu
    3. Press CTRL + SHIFT
    4. Click on the Open menu

    You could also use VSIPFactory to enable the feature for you:

    EnableVSIPLogging.png

    Tip:

    To get the content of the window you need to select the window and then press CTRL+C and paste it on a Notepad for example.

     

    Pablo

    posted Thursday, May 17, 2007 5:33 PM by pga with 2507 Comments

    Obtaining a ServiceProvider from a non sited component

    Many times we need to obtain a VS Service inside a VS Package from a component that is not sited.

    We can create a ServiceProvider by using a DTE instance:

    IServiceProvider serviceProvider =

                    newServiceProvider(dte as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);

    But what if we dont have access to a DTE instance at all?

    We can solve this issue by using the static GetGlobalService method of the Package class:

    EnvDTE.DTE dte = Package.GetGlobalService(typeof(EnvDTE.DTE));

     

    IServiceProvider serviceProvider =

        newServiceProvider(dte as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);

     

    IVsSolution solution = serviceProvider.GetType(SVsSolution) asIVsSolution;

    Note:

    We will need to add a reference to Microsoft.VisualStudio.OLE.Interop.dll and Microsoft.VisualStudio.Shell.dll

    Pablo

    posted Thursday, May 10, 2007 9:50 AM by pga with 2 Comments

    SFT Feb CTP is out!!!

    We are very happy to announce that the February CTP of SFT is OUT and I can assure you that it Rocks!!!.

    These are some features included on this release:

    Recipe Binder: bind recipes to any designer with a few mouse clicks.
    Recipe Designer: graphically edit your recipes. (YES you read it correctly :))
    MetaFactory: creates customized and usable SF solution.
    Manifest Validation: catch manifest errors early on and save time.
    Enhanced runtime: more integration assets added.

    Download it from here.

    Enjoy SFT!!!

    Pablo

    posted Wednesday, March 21, 2007 12:56 PM by pga with 1 Comments

    GAX Feb CTP is out!!!

    The February CTP of GAX (or GAX 1.2 internally) was released yesterday.

    Fixes:

    • Support for Windows Vista
    • Guidance Navigator performance and display improvements
    • Handling of read-only .gpstate files
    • Use of standard system colors in wizards and dialogs
    • Fixes to registration recipes

    Tom has a detailed list of fixes here

    You can download it from here

    Pablo

    posted Thursday, March 15, 2007 6:52 AM by pga with 1 Comments

    Code Snippets and GAX

    One GAX feature that is not well known is that we can define code snippets as part of our guidance package.
    These code snippets will be installed when we register the guidance package and they will be available at the product level.
    Once we create a guidance package solution using GAT the following structure is created:

    SolExt.JPG


    All the snippets must be under the \Snippets\LANGUAGE\PACKAGE_CAPTION folder.

    One important thing is that Caption for the guidance package located in the main manifest MUST match the name for the parent folder on the snippets structure.

    CaptionMatch.JPG

    If the names doesn't match the code snippets will no be installed when we register the guidance package.

    Once we register the guidance package and we create a product we can start using the codesnippets:

    csusage.jpg

    Pablo

    posted Thursday, January 11, 2007 5:26 AM by pga with 1 Comments

    Service Factory V2 is OUT!!!

    The december CTP of Service Factory was released, it includes valuable guidance for building ASMX and WCF services.

    This is a list of the main features:

    • WCF Support
    • WSDL first support
    • Versioning
    • VBNet support

    Get it from here and enjoy it.

     

    Pablo

    posted Wednesday, January 10, 2007 5:00 AM by pga with 0 Comments

    What Happens When

    I would like to start a new series of posts named What Happens When or WHW for now on.

    Basically I will try to explain what happens behind the scenes when we do things inside VS and GAX. I think this is very helpful to understand the internal mechanics of VS and GAX and how things work.

    So, the first post on this series is:

    WHW we register a guidance package?

    Answer:

    1. The guidance package project is compiled.
    2. The installer project is compiled and installed using installutil.
      1. An entry for the guidance package is added to the recipe framework manifest located at C:\Documents and Settings\All Users\Application Data\Microsoft\Recipe Framework\RecipeFramework.xml.
        1. This entry contains a timestamp that is used by the runtime to check if a guidance package was altered before loading it.
      2. The following registry entries are created:
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\AutoLoadPackages\<PackageGUID>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Menus\<PackageName>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\PseudoFolders\<PackageGUID>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\TemplateDirs\<PackageGUID>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\CodeExpansions\<LANGUAGE>\Paths\<PackageName>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\<PackageGUID>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\<PackageGUID>
      3. A devenv / Setup is done to update menus and commandbars defined in the guidance package (this step requires some time to process).

     

    Pablo

    posted Tuesday, January 09, 2007 7:08 AM by pga with 1 Comments

    Software Factories Toolkit is OUT!!!

    The first CTP of the SFT or Clarius Software Factory Toolkit was released yesterday.

    It has a lot features that will help you to author a guidance package:

    • VB Net support (Create a guidance package using VBNet)
    • DSL integration (Integrate your recipes with DSLs)
    • Eventing (Launch recipes based on VS events)
    • Scripting (Use the script value provider to assign values to recipe arguments inline)
    • Possibility to register a guidance package on the VS Exp Hive
    • Fixes for GAX known issues:
      • .gpstate and TFS issue fixed
    • and much more...

    Please download it now and tell us your story. You could win a free MSDN Team Suite subscription.

    On the next posts I will cover in more detail some of these features.

     

    Pablo

    posted Tuesday, December 19, 2006 6:15 AM by pga with 0 Comments

    Integrating DSL RTM and GAX part four

    As part of the DSL and GAX posts regarding integration, I would like to recommend an article made by Victor and Mauro named Guidance Automation Toolkit and Domain-Specific Language Tools for Visual Studio 2005: Integration Scenarios.

    It describes the process of integrating both technologies, I provided some tips of my previous posts: Integrating DSL RTM and GAX part one , Integrating DSL RTM and GAX part two ,  Integrating DSL RTM and GAX part three

    A must read...

    Pablo

    posted Thursday, November 09, 2006 10:03 AM by pga with 0 Comments

    Integrating DSL RTM and GAX part three

    On the part two, I talked about launching recipes from the DSL Designer.

    Another posibility is to launch a recipe from the DSL Language Explorer. For that we need the command bar GUID and ID.

    The good news is that the commandbar GUID is the same that the one for the DSL Designer

    The ID for the Language Explorer will always be 65537.

    DSLLangExplorer.JPG

     

    Pablo

    posted Wednesday, October 18, 2006 11:49 AM by pga with 1 Comments

    Manually Unregistering a Guidance package

    For manually unregister a guidance package we need to know two things:

    1. PackageName
    2. PackageGUID

    This information is located at the guidance package manifest file:

     

    gpguid.jpg

     

    Once we know this information, these are the steps that we need to perform:

     

    • Remove the guidance package entry from the recipe framework manifest
      • Go to C:\Documents and Settings\All Users\Application Data\Microsoft\Recipe Framework\RecipeFramework.xml
      • Delete the guidance package entry from the manifest using the PackageName

     

    • Remove registry entries
      • Open windows registry editor
      • Delete the following keys:
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\AutoLoadPackages\<PackageGUID>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Menus\<PackageName>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\PseudoFolders\<PackageGUID>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\NewProjectTemplates\TemplateDirs\<PackageGUID>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Languages\CodeExpansions\<LANGUAGE>\Paths\<PackageName>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\<PackageGUID>
        • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\<PackageGUID>

     

    Pablo

    posted Friday, October 13, 2006 11:05 AM by pga with 5 Comments

    Recipe CommandBar icons

    If we take a look at the xsd schema for the recipe definition (located at C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas\ GuidancePackageConfig.xml), the icon element of the HostData section consists of a GUID or an ID or a File.

    The xsd schema documentation for the ID saids:

    “The ID number of the icon in a DLL specified by the Guid attribute, if present. If no GUID is supplied, the ID attribute specifies an icon in the Microsoft Office library by default.”

     

    The question is how we can browse icons and the corresponding ids.

     

    The answer is FaceId Browser :

     

     

    faceid.jpg

     

    Using this tool or a similar one you can browse the icon and the corresponding id for the entire Microsoft Office library.

     

     

    Pablo

    posted Friday, October 13, 2006 7:47 AM by pga with 810 Comments

    Integrating DSL RTM and GAX part two

    Once we have the guidance package and the DSL package living on the same visual studio hive one thing that we will need for sure is the ability to launch recipes from the DSL designer.

    For that we need to find out the command bar GUID of the DSL designer.

    Steps:

    • Open the DSL solution
    • Open the Constants.cs file located under the DslPackage.csproj
    • Look for:         

        internal static partial class Constants

        {

            // Menu identifier

            public const string Language1CommandSetId = "a00ac613-8df8-4537-b7c7-89d31a44651c";

        }

    • Update the HostData section of the recipe manifest

      < HostData >

        < CommandBar Guid ="a00ac613-8df8-4537-b7c7-89d31a44651c"ID="65536"/>

      </ HostData

     

          Notice that the ID for the DSL RTM version will always be 65536.

     

    Pablo

    posted Monday, October 09, 2006 9:39 AM by pga with 6681 Comments

    Integrating DSL RTM and GAX part one

    A guidance package and a DSL package are registered by default in different visual studio hives. A guidance package lives on the main hive and a DSL package lives on the Experimental one.

    So the first thing that we need to do is migrate one of the packages so the live on the same hive.

    I am going to migrate the DSL package to the main hive, the procedure is very simple:

    A DSL solution consists of 2 projects, the Dsl.csproj and DslPackage.csproj and we need to edit both:

    Dsl.csproj:

    Change the line:

      <PropertyGroup>
        <StartProgram>$(DevEnvDir)\devenv.exe</StartProgram>
        <StartAction>Program</StartAction>
        <StartArguments>/rootsuffix Exp /DesignTimeRun "..\..\..\Debugging\Debugging.sln"</StartArguments>
      </PropertyGroup>

    To

      <PropertyGroup>
        <StartProgram>$(DevEnvDir)\devenv.exe</StartProgram>
        <StartAction>Program</StartAction>
        <StartArguments>/DesignTimeRun "..\..\..\Debugging\Debugging.sln"</StartArguments>
      </PropertyGroup>

    DslPackage.csproj:

    Change the line:

      <PropertyGroup>
        <StartProgram>$(DevEnvDir)\devenv.exe</StartProgram>
        <StartAction>Program</StartAction>
        <StartArguments>/rootsuffix Exp /DesignTimeRun "..\..\..\Debugging\Debugging.sln"</StartArguments>
      </PropertyGroup>

    To

      <PropertyGroup>
        <StartProgram>$(DevEnvDir)\devenv.exe</StartProgram>
        <StartAction>Program</StartAction>
        <StartArguments>/DesignTimeRun "..\..\..\Debugging\Debugging.sln"</StartArguments>
      </PropertyGroup>

    And

    <TargetRegistryRoot>Software\Microsoft\VisualStudio\8.0Exp</TargetRegistryRoot>

    To

    <TargetRegistryRoot>Software\Microsoft\VisualStudio\8.0</TargetRegistryRoot>

     

    After this changes the guidance package and the DSL will live in the same visual studio hive, which means that one is going to be "visible" by the other and viceversa.

     

    Pablo

    posted Monday, October 09, 2006 9:17 AM by pga with 1 Comments