Export (0) Print
Expand All

Adding a Package Load Key

Visual Studio .NET 2003
 

Microsoft Corporation

February 2004

Applies to:
    Microsoft Visual Studio .NET
    Microsoft Visual Studio.NET Integration Software Development Kit

Summary: Learn how to create and add a package load key (PLK) to a managed Visual Studio Package. (5 printed pages)

This article guides you through creating and adding a package load key (PLK) to a managed Microsoft Visual Studio Package (VSPackage). The Visual Studio Integration Package Wizard helps you create a sample managed VSPackage. You can then request a PLK for the resulting package GUID through the VSIP Developer Community Center. You need to install this PLK in the sample VSPackage and verify that it runs without the developer license key (DLK).

Carry out the following steps to add a Package Load Key:

To request the PLK from the VSIP developer Web site

  1. Create an extensibility project named MP.
    1. On the File menu, point to New, and then click Project.
    2. In the New Project dialog box, expand the Other Projects node, and select Extensibility Projects.
    3. Click the Visual Studio Integration Package icon in the Templates pane.
    4. In the Location box, type the file path for your VSPackage. In the Name box, type MP.
    5. Click OK to start the wizard.
  2. In the Basic VSPackage Information page of the Visual Studio Integration Package Wizard:
    1. Set Company Name to the name of your company.
      Note   This company name must be the same as the company name you used to register as a VSIP developer. The company name is used to calculate the PLK. If you have not already registered as a VSIP developer, use the name of your company. In this example, we use MyCompany.
    2. Set VSPackageName to MyProductName
      Note   In the PLK system, VSPackages are referred to only by GUID and products are referred to only by name. In this walkthrough, the VSPackage and product name are going to be the same.
  3. In the Select VSPackage Options page, check the Menu Command box. Accept all other defaults.

    The wizard generates a managed project MP and an unmanaged resource-only project MPUI.

  4. Build the solution and verify that it compiles without errors.
  5. Navigate to the VSIP Developer Community Center.

    If you have not already registered to be a VSIP developer, you must first register using the Register link.

  6. Follow the link to Request a Visual Studio .NET Package Load Key.
  7. Populate the required fields as follows:
    Field Name Value
    Contact Name Type your name. This field is not part of the PLK.
    Contact Email Type the email address to which you would like the PLK sent. This field is not part of the PLK.
    Package GUID You can find the package GUID in the file MP/Guids.cs, for example:
    public static readonly Guid guidMPPkg = 
       new Guid("{0421d354-4146-4555-86d7-
         f565c123ae3b}");
    
    

    Use the numeric value to fill in the field, for example:

    0421d354-4146-4555-86d7-f565c123ae3b
    
    
    Product Name Type the product name: MyProductName. This field is not case-sensitive.
    Product Version Type a product version, for example, 1.0.
    Product Description Type a product description, for example, This is a description of my product. This field is not part of the PLK.
    Minimum Product Edition Select a value from the dropdown list, for example, Standard.
    Application Residency Select Visual Studio .NET 2003 from the dropdown list.
    Resource DLL Filename Type in the name of your resource DLL, that is, MPUI.dll. This field is not part of the PLK.
  8. Check the compliance box and click Submit. For more information about writing a VSIP compliant product, see the Visual Studio Integration Test topic in VSIP help.

    The PLK Request screen displays the message, "Your request for a PLK has been approved. An e-mail has been sent to you containing your PLK."

  9. Check your e-mail for the PLK response. It should look something like this:
    Thank you for registering your product for a Package Load Key. 
    Here is the PLK you requested: 
    Package/Product Name: myproductname
    Version: 1.0
    Package GUID: {0421d354-4146-4555-86d7-f565c123ae3b}
    Package Load Key:
    P2R2E3I1HTRJH3DJIEKKDPRMD3JEECIHRHQ8C3EZZRMRAZC1AAK2KZA9RJDJKKKPZ
    3A3HMHJPKIIMIHKC2C3EQE3KHKTM3HPQPIHADPKRIQ8JQDHPMQIRJIPIHD9IJEQ
    
    

    To have the package load you'll have to have the following information under this package's registry info:

    NoRemove Packages 
    {
            ForceRemove {0421d354-4146-4555-86d7-f565c123ae3b} = s 'myproductname' 
            { 
            val CompanyName = s ' MyCompany' 
            val ProductName = s ' myproductname' 
            val ProductVersion = s '1.0' 
            val MinEdition = s 'standard' 
            val ID = d '1' 
            } 
    }
    
    
    Note   Please note that ID above is set to 1 as an example only. The PLK must be added to the string table in the resources of your main package's DLL. The ID value of the PLK string in the string table is the value that should be placed in the ID field in the registry. The PLK string may instead be added to the package's satellite DLL, but using the main package DLL is preferred.
    Note   Loading a PLK from the main package DLL is more efficient than loading it from the satellite DLL. The solution written by the Package Wizard, however, does not create a resource file for the managed DLL.

    To install the PLK in the sample and test it

    Add the following string resource to MPUI/MPUI.rc, giving it the value of the PLK you received. You can do this either by opening MPUI.rc in Resource View, or you can open it with the Source Code (Text) editor.

    IDS_VERSION           "1.0"
    IDS_MINVSEDITION   "Standard"
    IDS_PLK
      "P2R2E3I1HTRJH3DJIEKKDPRMD3JEECIHRHQ8C3EZZRMRAZC1AAK2K
      ZA9RJDJKKKPZ3A3HMHJPKIIMIHKC2C3EQE3KHKTM3HPQPIHADPKRIQ8JQ
      DHPMQIRJIPIHD9IJEQ"
    
    
    Note   The PLK string should be placed into your string resource table exactly as it appears in the PLK e-mail response, with no line breaks, quotation marks, or any other changes.
  10. Add the following boldfaced line to MPUI/resource.h, giving it a unique resource ID. Note that the resource editor will create this line for you.
    #define IDS_VERSION               104
    #define IDS_MINVSEDITION      105
    #define IDS_PLK                       106
    
    
  11. Open MP/VsPkg.cs and add a MSVSIP.Helper.RegisterLoadKey attribute to the MP class, the class derived from MSVSIP.Helper.Package. Make sure the last argument is the resource ID assigned to IDS_PLK.
    [MSVSIP.Helper.RegisterLoadKey("Standard", "1.0", "MyProductName", 
      "MyCompany", 106)]
    
    
    Note   Be sure the resource ID argument exactly matches the string resource ID. All other arguments should exactly match the information as it appears in the PLK e-mail response, except that all arguments are case-insensitive.
  12. Rebuild the solution and verify that it compiles without errors.

    The PLK is compiled into MPUI.dll, and the post-build step registers the PLK resource ID accordingly.

  13. In Solution Explorer, right-click the MP project node and select Properties. Add the /noVSIP switch to the Configuration Properties/Debugging/Command Line Arguments entry:
    /rootsuffix Exp /noVSIP
    
    

    This ensures that Visual Studio .NET will check the PLK instead of the DLK.

  14. Press the keyboard shortcut, F5, to launch the program under the debugger.

    Visual Studio .NET Exp starts.

  15. Select My Command Name from the Tools menu item.

    The Microsoft Development Environment message box appears. At the same time, you should see a message like this in the output window:

    VSIP: Developer edition disabled, normal security checks initiated.
      VSIP: Third party package 'MP' approved to load ( GUID = {0421D354-
      4146-4555-86D7-F565C123AE3B} ).
    
    

    This message shows that you have successfully loaded your VSPackage with the PLK.

Show:
© 2015 Microsoft