ProvideBindingRedirectionAttribute Class
Registers a set of values that define a binding redirection. These values are merged at startup into the CLR runtime configuration.
Inheritance Hierarchy
System.Object
System.Attribute
Microsoft.VisualStudio.Shell.RegistrationAttribute
Microsoft.VisualStudio.Shell.ProvideDependentAssemblyAttribute
Microsoft.VisualStudio.Shell.ProvideBindingRedirectionAttribute
Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)
Syntax
'Declaration
<AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple := True, Inherited := True)> _
Public NotInheritable Class ProvideBindingRedirectionAttribute _
Inherits ProvideDependentAssemblyAttribute
[AttributeUsageAttribute(AttributeTargets.Assembly, AllowMultiple = true, Inherited = true)]
public sealed class ProvideBindingRedirectionAttribute : ProvideDependentAssemblyAttribute
The ProvideBindingRedirectionAttribute type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ProvideBindingRedirectionAttribute | Initializes a new instance of the ProvideBindingRedirectionAttribute class. |
Top
Properties
Name | Description | |
---|---|---|
AssemblyName | Gets or sets the name of the target assembly. (Inherited from ProvideDependentAssemblyAttribute.) | |
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 | Gets or sets a string that specifies the language and country/region of the assembly. (Inherited from ProvideDependentAssemblyAttribute.) | |
GenerateCodeBase | Gets or sets the generated code base element. When false, no corresponding CodeBase element is generated for the redirected assembly (used for assemblies in the GAC). | |
Guid | Gets the identifier of this attribute instance. (Inherited from ProvideDependentAssemblyAttribute.) | |
NewVersion | Gets or sets the version of the assembly to use instead of the originally-requested version. | |
OldVersion | Gets the range of versions that will be redirected. | |
OldVersionLowerBound | Gets or sets the lower bound (inclusive) of the range of versions that will be redirected. | |
OldVersionUpperBound | Gets or sets the upper bound (inclusive) of the range of versions that will be redirected. | |
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 | Gets the current instance of this attribute. (Inherited from RegistrationAttribute.) |
Top
Methods
Name | Description | |
---|---|---|
Equals | Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) | |
GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsDefaultAttribute | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.) | |
Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) | |
Register | Registers this attribute with the given context. (Inherited from ProvideDependentAssemblyAttribute.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Unregister | Unregisters this attribute. (Inherited from ProvideDependentAssemblyAttribute.) |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
_Attribute.GetIDsOfNames | Maps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.) | |
_Attribute.GetTypeInfo | Retrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.) | |
_Attribute.GetTypeInfoCount | Retrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.) | |
_Attribute.Invoke | Provides access to properties and methods exposed by an object. (Inherited from Attribute.) |
Top
Remarks
By using the ProvideBindingRedirection attribute, you can specify binding redirection for the installation of an upgrade to an extensible component. When you ship an extensible Visual Studio component, this attribute prevents users of the component from having to install an old version of a dependent component. If you use the ProvideBindingRedirection attribute, you don't need to manually update the exe.config file to redirect users of the old assembly version to the new version.
Adding a ProvideBindingRedirection assembly attribute is an easy way to add a binding redirection entry to the pkgdef file. The pkgdef file is used to install the extension.
The following example shows a ProvideBindingRedirection entry in the AssemblyInfo.cs or AssemblyInfo.vb file:
<Assembly: ProvideBindingRedirection(AssemblyName:="ClassLibrary1",
NewVersion:="3.0.0.0", OldVersionLowerBound:="1.0.0.0",
OldVersionUpperBound:="2.0.0.0")>
[assembly: ProvideBindingRedirection(AssemblyName = "ClassLibrary1",
NewVersion = "3.0.0.0", OldVersionLowerBound = "1.0.0.0",
OldVersionUpperBound = "2.0.0.0")]
When the project is built, the following entry is added to the pkgdef file:
[$RootKey$\RuntimeConfiguration\dependentAssembly\bindingRedirection\{EE3E8305-3E91-51CD-0B2D-8E8EFFDD081C}]
"name"="ClassLibrary1"
"publicKeyToken"=""
"culture"="neutral"
"oldVersion"="1.0.0.0-2.0.0.0"
"newVersion"="3.0.0.0"
"codeBase"="$PackageFolder$\ClassLibrary1.dll"
You can also add a bindingRedirection entry directly to a pkgdef file.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.VisualStudio.Shell Namespace