How to: Add a PLK to a VSPackage Project (C#)
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
After you obtain a package load key (PLK), you must install it in your VSPackage. For more information, see How to: Obtain a PLK for a VSPackage.
To install and test a PLK in a VSPackage
Open the project to which you want to add the PLK.
In Solution Explorer find the resource file that is associated with your VSPackage, for example, VSPackage.resx, and open it.
Add a numbered resource, for example, 104. Give it the value of the PLK that you obtained for your VSPackage, for example:
- 104
HZDEE1RRAZPJJ3JDDEKKMHDICMA2CACREPK9DPRDCDE8QTZRQZJJJDJ2A8CKZAZ9M3ZZECPIRADDQ1RIIKMKQ9ZHCZH3MKAKQ9CRE2C9C2PKIDH1JIZMHZMQQHDMQ9DQ
Update or add the ProvideLoadKeyAttribute attribute to the class that implements your VSPackage, for example:
[ProvideLoadKey("Standard", "1.0", "My Package Name", "My Company", 104)] [Guid("5b28f8b4-3812-4b3c-b584-437433a45897")] public sealed class MyPackage : Package
where "Standard" is the minimum Visual Studio edition, "1.0" is the product version, "My Package Name" is the VSPackage name, "My Company" is your company name, and 104 is the resource ID of the PLK. All arguments should exactly match the information that was used to obtain the PLK.
Rebuild the solution and verify that it compiles without errors.
The PLK is compiled into the VSPackage and registered accordingly.
In Solution Explorer, right-click the MP project node and then click Properties. Add the /noVSIP switch to the Debug/Command line arguments entry:
/rootsuffix Exp /noVSIP
This makes sure that Visual Studio examines the PLK instead of the DLK.
Press F5 to start the program under the debugger.
Visual Studio Exp opens.
On the Tools menu, click MP.
A Visual Studio message box appears and you see a message such as this in the Output window of the experimental build:
VSIP: Third party package 'Vsip.MP.MP' ... approved to load ...
This message shows that you have successfully loaded your VSPackage with the PLK.
Note
If your package does not load, see How to: Troubleshoot a PLK Load Failure.