Pablo Galiano : Monday, June 04, 2007 - Posts

Subscriptions

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

News

Subscribe to Pablo Galiano by Email

Post Categories

Monday, June 04, 2007 - Posts

Finding local registry root on a running VS Instance

Suppose the scenario where you need to know the local registry root for a running instance of VS, to find out for example a list of registered VS Packages.

The local registry root depends on the registry hive where the VS is running into, so it could be :

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\

Or

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0Exp

Here is the code snippet that does the trick:

    string regRoot;

 

    ILocalRegistry3 registry = Package.GetGlobalService(typeof(SLocalRegistry)) asILocalRegistry3;

 

    ErrorHandler.ThrowOnFailure(registry.GetLocalRegistryRoot(out regRoot));

Pablo

posted Monday, June 04, 2007 6:54 PM by pga with 800 Comments

Visual Studio 2008 Shell

The Visual Studio 2008 Shell was just announced. After seeing the screenshots and reading the main features:

  • Faster Development. The Visual Studio Shell accelerates development by providing a base integrated development environment that can host custom tools and programming languages.
  • A Familiar Environment. Developers can build on the Visual Studio platform and provide end users a familiar user interface, speeding the learning curve for both.
  • Optimized for Languages & Tools. Created in response to requests from our partners, the Visual Studio Shell gives you the option of integrating your tools with Visual Studio or creating an isolated, custom-branded application.

I can only say WOW; finally extending VS will be much easier. :)

Meanwhile you can continue using VSIPFactory and of course a version running on top of Visual Studio 2008 Shell will be available in the future. :)

Pablo

posted Monday, June 04, 2007 6:42 PM by pga with 1 Comments

Loading a VS Package programmatically

When dealing with VS Packages sometimes we need to do some common operations like:

  • We want to know if a VS Package is loaded
  • We want to load a VS Package
  • We want to obtain a VS Package reference

The following snippet shows how to determine if a VS Package is loaded, how to load it and how to obtain a reference to an existing registered VS Package:

    IVsShell vsShell = Package.GetGlobalService(typeof(SVsShell)) as IVsShell;

 

    Guid packageGuid = new Guid("20D04F2E-0CA4-4f75-A21B-0DC6BAF9430A");

 

    IVsPackage package;

 

    vsShell.IsPackageLoaded(ref packageGuid, out package);

 

    if(package != null)

    {

        //Package Loaded

    }

    else

    {

        vsShell.LoadPackage(ref packageGuid, out package);

    }

Happy VS Extending :)

Pablo

posted Monday, June 04, 2007 6:34 PM by pga with 1 Comments