ProvideCodeBaseAttribute Class

Definition

This attribute registers a set of values that define a dependent assembly tag with a CodeBase. These values will be merged at startup into the CLR runtime configuration.

For example: [$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
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()

Initializes a new instance of the ProvideCodeBaseAttribute class.

Fields

_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)

Properties

AssemblyName

Name of the target assembly.

(Inherited from ProvideDependentAssemblyAttribute)
CodeBase

A relative path from the $PackageFolder$, or an absolute path rooted from an environment variable substitution (format: %variable%).

(Inherited from ProvideDependentAssemblyAttribute)
Culture

A string that specifies the language and country/region of the assembly.

(Inherited from ProvideDependentAssemblyAttribute)
CurrentAssembly

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

(Inherited from ProvideDependentAssemblyAttribute)
Guid

Identifier of this attribute instance.

(Inherited from ProvideDependentAssemblyAttribute)
PublicKeyToken

A 16 character hex number which is the token part of the strong name of the assembly being redirected.

(Inherited from ProvideDependentAssemblyAttribute)
TypeId

Gets the current instance of this attribute.

(Inherited from RegistrationAttribute)
Version

Specifies the version of the assembly to use instead of the originally requested version.

Methods

FormatPublicKeyToken(Byte[])

Format binary Public Key Token into an hexadecimal string.

(Inherited from ProvideDependentAssemblyAttribute)
GetGuidHashString()

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

(Inherited from ProvideDependentAssemblyAttribute)
GetPackageRegKeyPath(Guid)

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

(Inherited from RegistrationAttribute)
GetPathToKey()

Get the path to the Key were the values for this attribute will be registered.

(Inherited from ProvideDependentAssemblyAttribute)
Register(RegistrationAttribute+RegistrationContext)

Registers this attribute with the given context.

(Inherited from ProvideDependentAssemblyAttribute)
SetValues(RegistrationAttribute+Key)

Set values handled by this attribute in the given Key.

(Inherited from ProvideDependentAssemblyAttribute)
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)

Unregisters this attribute.

(Inherited from ProvideDependentAssemblyAttribute)
UpdateAssemblyInformation()

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

(Inherited from ProvideDependentAssemblyAttribute)
ValidateAttributeInformation()

Validate we have all the information that is needed.

(Inherited from ProvideDependentAssemblyAttribute)

Applies to