Specifies the version number of an exported type library.
Namespace:
System.Runtime.InteropServices
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
<ComVisibleAttribute(True)> _
<AttributeUsageAttribute(AttributeTargets.Assembly, Inherited := False)> _
Public NotInheritable Class TypeLibVersionAttribute _
Inherits Attribute
Dim instance As TypeLibVersionAttribute
[ComVisibleAttribute(true)]
[AttributeUsageAttribute(AttributeTargets.Assembly, Inherited = false)]
public sealed class TypeLibVersionAttribute : Attribute
[ComVisibleAttribute(true)]
[AttributeUsageAttribute(AttributeTargets::Assembly, Inherited = false)]
public ref class TypeLibVersionAttribute sealed : public Attribute
public final class TypeLibVersionAttribute extends Attribute
You can apply this attribute to assemblies.
By default, the Type Library Exporter (Tlbexp.exe) generates a type library version from the first two numbers of an assembly version. For example, Tlb.exe exports assembly version 1.2.5000.0 as a type library version 1.2, eliminating the build and revision numbers of the assembly. If this behavior is undesirable, you can control the generation of the type library number explicitly by applying the TypeLibVersionAttribute.
It is useful to control the generation of a type library version explicitly when two assembly versions produce the same type library version. For example, assembly version 1.2.0.0 and assembly version 1.2.500.0 both produce a type library version of 1.2, which can cause problems when you uninstall one of the assemblies. To differentiate the type library versions, you can force the second assembly (version 1.2.500.0) to produce a type library version of 1.25.
The following example shows how to apply the TypeLibVersionAttribute to explicitly set the type library version to 1.25.
Imports System
Imports System.Runtime.Interop
<Assembly: AssemblyVersion ("1.2.500.0")>
<Assembly: TypeLibVersionAttribute(1,25)>
Module MyNamespace
Public Class c
' Insert code.
End Class
using System;
using System.Runtime.InteropServices;
[Assembly: AssemblyVersion ("1.2.500.0")>
[Assembly: TypeLibVersion(1,25)]
namespace MyNamespace
{
class MyClass
{
// Insert code.
}
}
System..::.Object
System..::.Attribute
System.Runtime.InteropServices..::.TypeLibVersionAttribute
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 3.5, 3.0, 2.0, 1.1
Reference
Other Resources