ProvideCodeBaseAttribute ProvideCodeBaseAttribute ProvideCodeBaseAttribute ProvideCodeBaseAttribute ProvideCodeBaseAttribute Class

Definition

Registers a set of values that define a dependent assembly tag with a code base. These values are merged at startup into the CLR runtime configuration.

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
type ProvideCodeBaseAttribute = class
    inherit ProvideDependentAssemblyAttribute
Public NotInheritable Class ProvideCodeBaseAttribute
Inherits ProvideDependentAssemblyAttribute
Inheritance
Attributes

Remarks

By using the ProvideCodeBase attribute, you can specify a code base for an assembly in an extension without manually updating the exe.config file. This attribute indicates the location of the assembly so that the CLR can find it.

Adding a ProvideCodeBase assembly attribute is an easy way to add a code base entry to the pkgdef file. The pkgdef file is used to install the extension.

The following example shows a ProvideCodeBase entry in the AssemblyInfo.cs or AssemblyInfo.vb file:

[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")> 

When you build the project, the following entry is added to the pkgdef file:

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

You can also add a codeBase entry directly to a pkgdef file.

Constructors

ProvideCodeBaseAttribute() ProvideCodeBaseAttribute() ProvideCodeBaseAttribute() ProvideCodeBaseAttribute() ProvideCodeBaseAttribute()

Initializes a new instance of the ProvideCodeBaseAttribute class.

Properties

AssemblyName AssemblyName AssemblyName AssemblyName AssemblyName

Gets or sets the name of the target assembly.

(Inherited from ProvideDependentAssemblyAttribute)
CodeBase CodeBase CodeBase CodeBase CodeBase

Gets or sets a relative path from $PackageFolder$, or an absolute path rooted from an environment variable substitution (of format %variable%).

(Inherited from ProvideDependentAssemblyAttribute)
Culture Culture Culture Culture Culture

Gets or sets a string that specifies the language and country/region of the assembly.

(Inherited from ProvideDependentAssemblyAttribute)
CurrentAssembly CurrentAssembly CurrentAssembly CurrentAssembly CurrentAssembly

Gets or sets the assembly to which the generated dependentAssembly registry entry refers.

(Inherited from ProvideDependentAssemblyAttribute)
Guid Guid Guid Guid Guid

Gets the identifier of this attribute instance.

(Inherited from ProvideDependentAssemblyAttribute)
PublicKeyToken PublicKeyToken PublicKeyToken PublicKeyToken PublicKeyToken

Gets or sets a 16-character hexadecimal number which is the token part of the strong name of the assembly being redirected.

(Inherited from ProvideDependentAssemblyAttribute)
TypeId TypeId TypeId TypeId TypeId

Gets the current instance of this attribute.

(Inherited from RegistrationAttribute)
Version Version Version Version Version

Gets or sets the version of the assembly to use instead of the originally-requested version.

Fields

_guidUpdateNeeded _guidUpdateNeeded _guidUpdateNeeded _guidUpdateNeeded _guidUpdateNeeded

Indicates whether a GUID update is required. If true, a GUID update is required. If false (default), no update is required.

(Inherited from ProvideDependentAssemblyAttribute)

Methods

FormatPublicKeyToken(Byte[]) FormatPublicKeyToken(Byte[]) FormatPublicKeyToken(Byte[]) FormatPublicKeyToken(Byte[]) FormatPublicKeyToken(Byte[])

Formats a binary public key token into a hexadecimal string.

(Inherited from ProvideDependentAssemblyAttribute)
GetGuidHashString() GetGuidHashString() GetGuidHashString() GetGuidHashString() GetGuidHashString()

Gets the string that will be hashed into the identifier of the attribute.

(Inherited from ProvideDependentAssemblyAttribute)
GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid) GetPackageRegKeyPath(Guid)

Gets the registry path (relative to the registry root of the application) of the VSPackage.

(Inherited from RegistrationAttribute)
GetPathToKey() GetPathToKey() GetPathToKey() GetPathToKey() GetPathToKey()

Gets the path to the key were the values for this attribute will be registered.

(Inherited from ProvideDependentAssemblyAttribute)
Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext) Register(RegistrationAttribute+RegistrationContext)

Registers this attribute with the given context.

(Inherited from ProvideDependentAssemblyAttribute)
SetValues(RegistrationAttribute+Key) SetValues(RegistrationAttribute+Key) SetValues(RegistrationAttribute+Key) SetValues(RegistrationAttribute+Key) SetValues(RegistrationAttribute+Key)

Set values handled by this attribute in the given key.

(Inherited from ProvideDependentAssemblyAttribute)
TryParseVersion(String, Version) TryParseVersion(String, Version) TryParseVersion(String, Version) TryParseVersion(String, Version) TryParseVersion(String, Version)

Try to parse a string into a Version. Unlike Version.TryParse, this method ensures that the input consists of four numbers, as opposed to considering the build and revision numbers optional.

(Inherited from ProvideDependentAssemblyAttribute)
Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext) Unregister(RegistrationAttribute+RegistrationContext)

Unregisters this attribute.

(Inherited from ProvideDependentAssemblyAttribute)
UpdateAssemblyInformation() UpdateAssemblyInformation() UpdateAssemblyInformation() UpdateAssemblyInformation() UpdateAssemblyInformation()

Updates all information not provided from the assembly to which this attribute is applied.

(Inherited from ProvideDependentAssemblyAttribute)
ValidateAttributeInformation() ValidateAttributeInformation() ValidateAttributeInformation() ValidateAttributeInformation() ValidateAttributeInformation()

Validates that all the required information has been supplied.

(Inherited from ProvideDependentAssemblyAttribute)

Applies to