Pablo Galiano : Monday, July 06, 2009 - Posts

Subscriptions

<March 2010>
SuMoTuWeThFrSa
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

News

Subscribe to Pablo Galiano by Email

Post Categories

Monday, July 06, 2009 - Posts

MEF VSIX Project template

I have just uploaded a new Visual Studio extension to the Visual Studio Gallery

It is basically a new project template to create MEF based Visual Studio extensions (VSIX)

The differences between this project template and the one that comes with the VS SDK are:

  • Assembly references
    • System.ComponentModel.Composition.dll
    • Microsoft.VisualStudio.ExtensibilityHosting.dll
  • A MyExport class in created
  • public interface IMyExport
    {
    }

    [Export(typeof(IMyExport))]
    public class MyExport : IMyExport
    {
    }

  • The AssemblyInfo contains the VsCatalogName attribute

//TODO: Specify the catalog name for the exported objects
[assembly: VsCatalogName("Foo")]

  • The extension manifest contains the MEFComponent content type

<Content>
  <MEFComponent>MEFVSIXProject3</MEFComponent>
</Content>

After you install it, it is displayed under the Visual C# category

image

You can also discover it by browsing the Online Templates tab in the new Add New Project dialog:

image

 

Enjoy,

Pablo

posted Monday, July 06, 2009 9:46 AM by pga with 0 Comments

VS10 beta 1 The registry hives

***Disclaimer: This information applies to Visual Studio 2010 Beta 1 only.***

 

The following list describes the registry hives used by VS 2008 and VS10

VS 2008

Main hive

  • Root: HKLM\Software\Microsoft\VisualStudio\9.0
  • User settings: HKCU\Software\Microsoft\VisualStudio\9.0

Exp hive

  • Root: HKCU\Software\Microsoft\VisualStudio\9.0Exp\Configuration
  • User settings: HKCU\Software\Microsoft\VisualStudio\9.0Exp\UserSettings

 

VS10

Main hive

  • Root: HKLM\Software\Microsoft\VisualStudio\10.0
  • Root cache: HKCU\Software\Microsoft\VisualStudio\10.0_Config
  • User settings: HKCU\Software\Microsoft\VisualStudio\10.0

Exp hive

  • Root: HKCU\Software\Microsoft\VisualStudio\10.0Exp_Config
  • User settings: HKCU\Software\Microsoft\VisualStudio\10.0Exp

 

The registry root cache

This is the real hive that is being used by Visual Studio and its being created / updated at Visual Studio startup time.

Creation / Reconstruction

If the hive doesn’t exist it is created using the root (HKLM\Software\Microsoft\VisualStudio\10.0) base information. This means that we can safely delete the hive and it will be created again on next Visual Studio launch.

If it exists but it differs from the root (HKLM\Software\Microsoft\VisualStudio\10.0) is its reconstructed.

Update

If we recall the No more Devenv /Setup post Visual Studio monitors the following folders:

  • %LocalAppData%\Microsoft\VisualStudio\10.0\Extensions
  • %VS10_Install_Dir%\Common7\IDE\Extensions
  • %VS10_Install_Dir%\Common7\IDE\CommonExtensions

During VS startup if any changes are detected in those folders (new / delete / update) the pkgdef are merged again into the hive to reflect the latest definition.

 

Pablo

posted Monday, July 06, 2009 5:50 AM by pga with 15 Comments

Deploying a VSIX as a trusted extension

***Disclaimer: This information applies to Visual Studio 2010 Beta 1 only.***

 

Let’s say that we want to deploy our extension as a trusted extension.

For that VSIXInstaller tool supports the /admin switch.

When we pass the /admin argument to the tool the VSIX is deployed under %VS10_Install_Dir%\Common7\IDE\Extensions

Notice that you will need to execute the VSIXInstaller tool with administration privileges.

 

Pablo

posted Monday, July 06, 2009 5:47 AM by pga with 0 Comments

VS10 beta 1 How do I hide an extension

***Disclaimer: This information applies to Visual Studio 2010 Beta 1 only.***

 

If we want to hide an extension in the extension manager dialog we need to add the “SystemComponent” node in our VSIX manifest.

For example let’s take a look at the Visual Studio editor VSIX manifest:

<VSIX xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">

  <Identifier ID="Microsoft.VisualStudio.Editor">
    <Name>Microsoft Visual Studio Editor</Name>
    <Author>Microsoft Corporation</Author>
    <Version>10.0</Version>
    <Description>Microsoft Visual Studio Editor</Description>
      …

    <SystemComponent>true</SystemComponent>

      …

  </Identifier>

  <References/>

  <Content>
     …

    <MEFComponent>Microsoft.VisualStudio.Editor.dll</MEFComponent>
     …

  </Content>

</VSIX>

 

The  extension manager dialog then filters extensions with the “SystemComponent” node and the result is that they are hidden to the user. As you can see in the screenshot below the core Visual Studio Editor extension is not shown.

 

image

 

Pablo

posted Monday, July 06, 2009 5:46 AM by pga with 0 Comments