This documentation is archived and is not being maintained.

TypeLibVersionAttribute Class

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Specifies the version number of an exported type library.

For a list of all members of this type, see TypeLibVersionAttribute Members.


[Visual Basic]
NotInheritable Public Class TypeLibVersionAttribute
   Inherits Attribute
public sealed class TypeLibVersionAttribute : Attribute
public __gc __sealed class TypeLibVersionAttribute : public
class TypeLibVersionAttribute extends Attribute

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.


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 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.


[Visual Basic, C#] The following example shows how to apply the System.Runtime.InteropServices.TypelibVersionAttribute to explicitly set the type library version to 1.25.

[Visual Basic] 
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.

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.


Namespace: System.Runtime.InteropServices

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

TypeLibVersionAttribute Members | System.Runtime.InteropServices Namespace | Type Library Exporter (Tlbexp.exe)