ProvideLoadKeyAttribute(String, String, String, String, Int16) 建構函式

定義

建立新的 ProvideLoadKeyAttributeCreates a new ProvideLoadKeyAttribute.

public:
 ProvideLoadKeyAttribute(System::String ^ minimumEdition, System::String ^ productVersion, System::String ^ productName, System::String ^ companyName, short resourceId);
public:
 ProvideLoadKeyAttribute(Platform::String ^ minimumEdition, Platform::String ^ productVersion, Platform::String ^ productName, Platform::String ^ companyName, short resourceId);
 ProvideLoadKeyAttribute(std::wstring const & minimumEdition, std::wstring const & productVersion, std::wstring const & productName, std::wstring const & companyName, short resourceId);
public ProvideLoadKeyAttribute (string minimumEdition, string productVersion, string productName, string companyName, short resourceId);
new Microsoft.VisualStudio.Shell.ProvideLoadKeyAttribute : string * string * string * string * int16 -> Microsoft.VisualStudio.Shell.ProvideLoadKeyAttribute
Public Sub New (minimumEdition As String, productVersion As String, productName As String, companyName As String, resourceId As Short)

參數

minimumEdition
String

載入 VSPackage 的 Visual Studio 最小版本。The minimum edition of Visual Studio on which the VSPackage is loaded. 當 (PLK) 取得封裝載入金鑰時,這必須是 Microsoft 所提供的常值版本值。This must be the literal edition value provided by Microsoft when obtaining your Package Load Key (PLK).

productVersion
String

此 VSPackage 所實行的產品版本。The version of the product that this VSPackage implements.

productName
String

此 VSPackage 所提供之產品的名稱。Name of the product that this VSPackage delivers. 由多個 Vspackage 組成的產品,各自需要自己的 PLK。Products comprised of multiple VSPackages each need their own PLK.

companyName
String

VSPackage 的 VSIP 夥伴/建立者。VSIP Partner/creator of the VSPackage. 當您註冊 PLK 時,必須完全符合您提供給 Microsoft 的名稱。Must exactly match the name you provided to Microsoft when you registered for a PLK. companyName 會區分大小寫。companyName is case-sensitive.

resourceId
Int16

VSPackage load key 的資源識別碼。Resource ID for VSPackage load key.

例外狀況

minimumEdition, productVersion, productName companyName nullminimumEdition, productVersion, productName or companyName are null.

範例

下列程式 Visual C#Visual C# 代碼會將 ProvideLoadKey 屬性套用至名為 MyVSPackage 的 VSPackage。The following Visual C#Visual C# code applies the ProvideLoadKey attribute to a VSPackage named MyVSPackage.

using Microsoft.VisualStudio.Shell;  
using MSVSIP = Microsoft.VisualStudio.Shell;  
[MSVSIP.ProvideLoadKey(typeof(MyObject))]  
public class MyVSPackage : MSVSIP.Package {}  

備註

重要

以 Visual Studio 2010 為目標的套件,不需要封裝載入金鑰。Packages that target Visual Studio 2010 only do not need a package load key.

以 Visual Studio 2008 及更早版本為目標的套件必須有封裝載入金鑰,才能驗證和載入 Vspackage。Packages that target Visual Studio 2008 and earlier must have a package load key in order to validate and load VSPackages. 這包括由協力廠商提供的 Vspackage,不論裝載版本的是否 Visual StudioVisual Studio 有 VSIP 授權。This includes VSPackages provided by third parties, regardless of whether the hosting version of Visual StudioVisual Studio has a VSIP license.

注意

Visual C#Visual C# 自動將 word 屬性附加至任何屬性類別的名稱。automatically appends the word Attribute to the name of any attribute class. 在程式 Visual C#Visual C# 代碼中,請將此屬性稱為 ProvideLoadKeyIn Visual C#Visual C# code, refer to this attribute as ProvideLoadKey.

適用於