We recommend using Visual Studio 2017

How to: Brand a VSPackage (C# and Visual Basic)

 

To appear in the About dialog box and the splash screen, VSPackages must implement the IVsInstalledProduct interface. This provides the following information to Visual Studio:

  • Name

  • ID, such as serial or version number

  • Information

  • Logo icon

The following code is from VSSDK Samples.

To implement the IVsInstalledProduct interface

  1. Add the InstalledProductRegistrationAttribute attribute to the class that implements the VSPackage. This class must derive from both Package and IVsInstalledProduct.

    [InstalledProductRegistration(true, null, null, null)]
    [DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\8.0")]
    [PackageRegistration(UseManagedResourcesOnly = true)]
    [Guid("EEE474A0-083B-4e9c-B453-F6FCCEDA2577")]
    public sealed class PackageSplashHelpAboutLoadKey : 
        Package, IVsInstalledProduct
    

    The first argument, UseInterface, of the InstalledProductRegistrationAttribute attribute tells Visual Studio to use IVsInstalledProduct to obtain product information, instead of the InstalledProducts registry key. The remaining arguments select string resources to display the product name, details, and ID, respectively. However, because the first argument is true, the remaining arguments are null.

  2. Right-click IVsInstalledProduct, point to Implement Interface, and then click Implement Interface.

  3. Implement IVsInstalledProduct by using the following code.

    public int IdBmpSplash(out uint pIdBmp)
    {
        pIdBmp = 300;
        return VSConstants.S_OK;
    }
    public int IdIcoLogoForAboutbox(out uint pIdIco)
    {
        pIdIco = 400;
        return VSConstants.S_OK;
    }
    public int OfficialName(out string pbstrName)
    {
        pbstrName = GetResourceString("@101");
        return VSConstants.S_OK;
    }
    public int ProductDetails(out string pbstrProductDetails)
    {
        pbstrProductDetails = GetResourceString("@102");
        return VSConstants.S_OK;
    }
    public int ProductID(out string pbstrPID)
    {
        pbstrPID = GetResourceString("@104");
        return VSConstants.S_OK;
    }
    public string GetResourceString(string resourceName)
    {
        string resourceValue;
        IVsResourceManager resourceManager =
            (IVsResourceManager)GetService(typeof(SVsResourceManager));
        if (resourceManager == null)
        {
            throw new InvalidOperationException(
                "Could not get SVsResourceManager service. Make sure that the package is sited before calling this method");
        }
        Guid packageGuid = this.GetType().GUID;
        int hr = resourceManager.LoadResourceString(
            ref packageGuid, -1, resourceName, out resourceValue);
        Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hr);
        return resourceValue;
    }
    

    Visual Studio calls these methods to obtain information for branding the VSPackage. The GetResourceString method is used to localize this information.

    System_CAPS_noteNote

    Code comments are deleted for brevity. You can find them in VSSDK Samples.

To maintain the product information strings

  1. Double-click the .resx resource file associated with the VSPackage.

    The resource editor opens.

  2. Find or add the product name, information, and ID.

    The following resource strings are from the VSSDK Samples.

    @101

    Package Splash screen and Help About Official Name (C#).

    @102

    This package demonstrates how to display text and image in the splash screen and the help about.

    @104

    8.0

  3. Select and edit this information as you want.

To maintain the product icons and bitmaps

  1. Add the bitmaps and icons to the project as project resources.

    For more information, see NOT IN BUILD: Adding and Editing Resources (Visual C#).

  2. Close the resource editor and reopen the .resx file in an XML or text editor.

    System_CAPS_noteNote

    The resource editor does not support assigning resource IDs to items other than strings.

  3. Find or add the icon and bitmap resources to the .resx file. The following resources are from VSSDK Samples.

    <data name="300" type="System.Resources.ResXFileRef, System.Windows.Forms">
        <value>GenericPackage.bmp;System.Drawing.Bitmap, System.Drawing,
            Version=2.0.0.0, Culture=neutral,         PublicKeyToken=b03f5f7f11d50a3a</value>
    </data>
    <data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
        <value>GenericPackage.ico;System.Drawing.Icon, System.Drawing,
            Version=2.0.0.0, Culture=neutral,         PublicKeyToken=b03f5f7f11d50a3a</value>
    </data>
    

To test the About dialog box and splash screens

Show: