
Obtain and Use a Package Load Key (PLK)
When you distribute a VSPackage to other users, it must contain a resource named the Package Load Key (PLK). Except in the experimental build, Visual Studio cannot load VSPackages that do not contain a valid PLK.
In the experimental build, all VSPackages can be loaded so that they can be tested during development. To enable this, the Visual Studio SDK provides a special Developer Load Key (DLK). However, the Microsoft Software License Terms for the Visual Studio SDK do not allow you to redistribute the DLK.
For this tutorial, we will provide a PLK so that you do not have to obtain one on your own. A PLK value depends on the VSPackage GUID, which is derived from information that you supply when you create a VSPackage. To use the PLK that we provide for the package in this tutorial, you must change the VSPackage GUID to match the one that we used to generate the PLK.
To change the VSPackage GUID to match the provided PLK
Open First.vsct and change the value of the GuidSymbol tag as follows.
|
<GuidSymbol name="guidFirstPkg" value="{3fdab115-3cc1-457d-bd2a-78d72c7025be}" />
|
Open Guid.cs and change the value of guidFirstPackageString.
|
public const string guidFirstPkgString="3fdab115-3cc1-457d-bd2a-78d72c7025be";
|
To add the PLK to the VSPackage, complete the following procedure.
To add the PLK to the VSPackage
In Solution Explorer, double-click VSPackage.resx to open it in the resource designer. A grid control appears.
Add a resource and give it a unique number in the Name column, for example, 104. In the Value column, enter the following PLK. Enter it as an unbroken string.
JEAPP8CCIKQCA0IRC9ZECMDRPZEZP2E3HPA9MRETM0CKJKK3JEKDAIDMKQR2EHK2CJKCQJKHAMQTAKDKIZPHM8KDCMC0AIEME0KAKAACCMM1QHH2ECEKH1JIQQIEZIPR
.png)
Open VsPkg.cs and find the ProvideLoadKey attribute. Replace the last argument by using the resource name of the PLK, for example, 104.
|
[ProvideLoadKey("Standard", "1.0", "FirstPackage", "Company", 104)]
|
To test the PLK, complete the following procedure.
To test the PLK
In Solution Explorer, right-click the First project node, and then click Properties. The application designer appears.
Click Debug. The Debug options pane appears.
In the Command line arguments box, add /noVSIP. Doing this disables the DLK.
.png)
Press F5 to open Visual Studio in the experimental mode.
On the Help menu, click About Microsoft Visual Studio.
The About dialog box appears and displays the icon and text for your VSPackage.
Close the experimental build of Visual Studio.
Change any letter in the PLK string resource.
Press F5 to open Visual Studio in the experimental mode and then look at the About dialog box again.
This time you should see a message that alerts you about a PLK load failure.
.png)
When you are ready to distribute your VSPackage, you can obtain a PLK for it by visiting the the Visual Studio Extensibility Developer Center Web site. After you log on, follow the instructions to obtain a PLK. For more information, see How to: Obtain a PLK for a VSPackage.