GAT
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
A solution item template is an VS item template that is available at the Solution level.
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
- Custom Templates
The location for the custom templates can be modified:
So lets see again the locations:
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:
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
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
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
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
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
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:
- Click on the File menu
- Hover the mouse over the Open sub menu
- Press CTRL + SHIFT
- Click on the Open menu
You could also use VSIPFactory to enable the feature for you:
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
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
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
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
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:
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.
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:
Pablo
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
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:
- The guidance package project is compiled.
- The installer project is compiled and installed using installutil.
- 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.
- This entry contains a timestamp that is used by the runtime to check if a guidance package was altered before loading it.
- 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>
- A devenv / Setup is done to update menus and commandbars defined in the guidance package (this step requires some time to process).
Pablo
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
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
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.
Pablo
For manually unregister a guidance package we need to know two things:
-
PackageName
-
PackageGUID
This information is located at the guidance package manifest file:
Once we know this information, these are the steps that we need to perform:
- 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
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 :
Using this tool or a similar one you can browse the icon and the corresponding id for the entire Microsoft Office library.
Pablo