Share via


ProvideCodeBaseAttribute 類別

定義

這個屬性會註冊一組值,以 CodeBase 定義相依元件標記。 這些值會在啟動時合併到 CLR 執行時間組態中。

例如:[$RootKey$\RuntimeConfiguration\dependentAssembly\codeBase{5C48C732-5C7F-40f0-87A7-05C4F15BC8C3}] “Name”=“AssemblyName” “PublicKeyToken”=“19ab8cb7287f414” “Culture”=“neutral” “Version”=“2.0.0.0” “CodeBase”=“$PackageFolder$\AssemblyName.dll”

public ref class ProvideCodeBaseAttribute sealed : Microsoft::VisualStudio::Shell::ProvideDependentAssemblyAttribute
public ref class ProvideCodeBaseAttribute sealed : Microsoft::VisualStudio::Shell::ProvideDependentAssemblyAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=true)]
public sealed class ProvideCodeBaseAttribute : Microsoft.VisualStudio.Shell.ProvideDependentAssemblyAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=true, Inherited=true)>]
type ProvideCodeBaseAttribute = class
    inherit ProvideDependentAssemblyAttribute
Public NotInheritable Class ProvideCodeBaseAttribute
Inherits ProvideDependentAssemblyAttribute
繼承
屬性

備註

藉由使用 ProvideCodeBase 屬性,您可以在延伸模組中指定元件的程式代碼基底,而不需手動更新 exe.config 檔案。 這個屬性會指出元件的位置,讓CLR可以找到它。

ProvideCodeBase新增元件屬性是將程式代碼基底專案新增至 pkgdef 檔案的簡單方式。 pkgdef 檔案是用來安裝延伸模組。

下列範例顯示 ProvideCodeBase AssemblyInfo.cs或AssemblyInfo.vb檔案中的專案:

[assembly: ProvideCodeBase(AssemblyName = "ClassLibrary1",
Version = "1.0.0.0", CodeBase = "$PackageFolder$\\ClassLibrary1.dll")]
<Assembly: ProvideCodeBase(AssemblyName:="ClassLibrary1",
    Version:="1.0.0.0", CodeBase:="$PackageFolder$\ClassLibrary1.dll")> 

當您建置專案時,會將下列專案新增至 pkgdef 檔案:

[$RootKey$\RuntimeConfiguration\dependentAssembly\codeBase\{D5206E57-D855-61F6-3D7E-EF7F72D9FAA7}]  
"name"="ClassLibrary1"  
"publicKeyToken"=""  
"culture"="neutral"  
"version"="2.0.0.0"  
"codeBase"="$PackageFolder$\ClassLibrary1.dll"  

您也可以直接將 codeBase 專案新增至 pkgdef 檔案。

建構函式

ProvideCodeBaseAttribute()

初始化 ProvideCodeBaseAttribute 類別的新執行個體。

欄位

_guidUpdateNeeded

指出是否需要 GUID 更新。 如果 true為 ,則需要 GUID 更新。 如果 false (預設) ,則不需要更新。

(繼承來源 ProvideDependentAssemblyAttribute)

屬性

AssemblyName

目標元件的名稱。

(繼承來源 ProvideDependentAssemblyAttribute)
CodeBase

$PackageFolder$ 的相對路徑,或以環境變數替代 (格式為根的絕對路徑:%variable%) 。

(繼承來源 ProvideDependentAssemblyAttribute)
Culture

指定組件語言及國家/地區的字串。

(繼承來源 ProvideDependentAssemblyAttribute)
CurrentAssembly

取得或設定產生的 dependentAssembly 登錄專案所參考的元件。

(繼承來源 ProvideDependentAssemblyAttribute)
Guid

這個屬性實例的標識碼。

(繼承來源 ProvideDependentAssemblyAttribute)
PublicKeyToken

16 個字元十六進位數位,這是要重新導向之元件強名稱的令牌部分。

(繼承來源 ProvideDependentAssemblyAttribute)
TypeId

覆寫 TypeID 屬性,讓 RegistrationAttribute 衍生類別使用 System.ComponentModel.TypeDescriptor.GetAttributes (...) 。衍生自這個屬性的屬性必須覆寫此屬性,只有在實例上需要更好的控件,才能套用至類別。

(繼承來源 RegistrationAttribute)
Version

指定要使用的元件版本,而不是原始要求的版本。

方法

FormatPublicKeyToken(Byte[])

將二進位公鑰令牌格式化為十六進位字串。

(繼承來源 ProvideDependentAssemblyAttribute)
GetGuidHashString()

取得將哈希為 屬性標識碼的字串。

(繼承來源 ProvideDependentAssemblyAttribute)
GetPackageRegKeyPath(Guid)

取得相對於 VSPackage 應用程式) 之登錄根目錄的登錄路徑 (。

(繼承來源 RegistrationAttribute)
GetPathToKey()

取得金鑰的路徑是將會註冊此屬性的值。

(繼承來源 ProvideDependentAssemblyAttribute)
Register(RegistrationAttribute+RegistrationContext)

向指定的內容註冊這個屬性。

(繼承來源 ProvideDependentAssemblyAttribute)
SetValues(RegistrationAttribute+Key)

在指定的索引鍵中設定此屬性所處理的值。

(繼承來源 ProvideDependentAssemblyAttribute)
TryParseVersion(String, Version)

嘗試將字串剖析成 Version。 不同於 Version.TryParse,此方法可確保輸入包含四個數位,而不是考慮建置和修訂編號為選擇性。

(繼承來源 ProvideDependentAssemblyAttribute)
Unregister(RegistrationAttribute+RegistrationContext)

取消註冊這個屬性。

(繼承來源 ProvideDependentAssemblyAttribute)
UpdateAssemblyInformation()

更新未從套用此屬性的元件提供的所有資訊。

(繼承來源 ProvideDependentAssemblyAttribute)
ValidateAttributeInformation()

驗證我們有所有必要的資訊。

(繼承來源 ProvideDependentAssemblyAttribute)

適用於