How to install and uninstall regasm

Source: Internet
Author: User

Install

C: \ windows \ Microsoft. NET \ framework \ v1.1.4322 \ regasm.exe "C: \ Program Files \ mydllfoldername \ mydllname. dll"/TLB

C: \ windows \ Microsoft. NET \ framework \ v2.0.50727 \ regasm.exe "C: \ Program Files \ mydllfoldername \ mydllname. dll"/TLB

C: \ windows \ Microsoft. NET \ framework \ v4.0.30319 \ regasm.exe "C: \ Program Files \ mydllfoldername \ mydllname. dll"/TLB

Uninstall

C: \ windows \ Microsoft. NET \ framework \ v1.1.4322 \ regasm.exe "C: \ Program Files \ mydllfoldername \ mydllname. dll"/u

C: \ windows \ Microsoft. NET \ framework \ v2.0.50727 \ regasm.exe "C: \ Program Files \ mydllfoldername \ mydllname. dll"/u

C: \ windows \ Microsoft. NET \ framework \ v4.0.30319 \ regasm.exe "C: \ Program Files \ mydllfoldername \ mydllname. dll"/u

The Assembly registration tool reads the metadata in the Assembly and adds the required items to the Registry. The registry allows com client programs to create. NET Framework classes transparently. Once the class is registered, any COM Client program can use it, as if the class is a com class. Class is registered only once when the program is installed. Class instances in the Assembly cannot be created from com until they are actually registered.

Regasm assemblyfile [Options]

Parameters

Parameter description
Assemblyfile
The assembly to be registered with COM.

 

Option description
/Codebase
Create a codebase entry in the registry. The codebase item specifies the file path of the Assembly that is not installed in the Global Assembly Cache. This option should not be specified if you want to install an assembly that is being registered to the Global Assembly Cache. The assemblyfile parameter specified with the/codebase option must be an assembly with a strong name.

/Registered
Specifying this tool will only reference registered type libraries.

/Asmpath: Directory
Specifies the directory that contains the Assembly reference. Must be used with the/regfile option.

/Nologo
Undisplay Microsoft startup title.

/Regfile [: regfile]
Generate the specified. reg file for the Assembly, which contains the required registry key. Specify this option without changing the registry. This option cannot be used with the/u option or/TLB option.

/Silent or/s
The message indicating successful cancellation is displayed.

/TLB [: typelibfile]
Generate a type library from the specified assembly. The Type Library contains the definition of accessible types defined in the Assembly.

/Unregister or/u
Unregister the class that can be created in assemblyfile. If this option is omitted, regasm.exe registers the class that can be created in the Assembly.

/Verbose
Specify the verbose mode. When the/TLB option is used, a list of all referenced assemblies for which the type library needs to be generated is displayed.

/? Or/help
Displays the command syntax and options of the tool.

Note:
The regasm.exe command line options are case insensitive. You only need to provide enough options to uniquely identify it. For example,/N is equivalent to/nologo, while/T: OUTFILE. TLB is equivalent to/TLB: OUTFILE. TLB.

You can use the/regfile option to generate a. reg file containing the registry key, instead of directly modifying the registry. You can use the Registry Editor tool (regedit.exe) to import the. reg file and update the Registry on your computer. Note that the. reg file does not contain any registry updates that can be completed by user-defined registration functions. Note that the/regfile option only issues the registry key for the Managed class. This option does not issue a registry key for typelibid or interfaceid.

When/TLB is specified, regasm.exe generates and registers a Type Library to describe the type found in the program set. Regasm.exe places the generated Type Library in the current working directory or the directory specified for the output file. Generating a Type Library for an assembly that references other assemblies may generate several types of libraries at the same time. You can use a Type Library to provide type information to development tools (such as Visual Studio 2005. If the registered assembly is generated by the Type Library import program (tlbimp.exe), The/TLB option should not be used. If an assembly is imported from a Type Library, the Type Library cannot be exported from it. Except for the Type Library Export Program (tlbexp.exe)
You cannot register a Type Library generated by it. Using the/TLB option has the same effect as using tlbexp.exe and regasm.exe. If you use the/TLB option to register a type library, you can use the/TLB option with the/unregister option to deregister the Type Library. Use the two options together to deregister the Type Library and interface items so that the registry can be cleared to a large extent.

When you register an assembly for com, regasm.exe adds some items to the registry of the local computer. More specifically, it creates version-related registry items that allow parallel running of multiple versions of the same assembly on a computer. When you register an assembly for the first time, a top-level item is created for the Assembly and a unique sub-item is created for the assembly version. Regasm.exe creates a subitem for the new version every time it registers the new feature of the program set.

For example, assume that you want to register a managed component mycomp. dll of version 1.0.0.0 for com. Later, you registered the version of mycomp. dll 2.0.0.0. Make sure that all COM Client Applications on the computer use mycomp. dll of version 2.0.0.0, and decide to cancel mycomponent. dll version 1.0.0.0. This registry solution allows you to log out of mycomp. dll version 1.0.0.0 because only the subitem 1.0.0.0 is removed.

After registering an assembly using regasm.exe, you can install the assembly in the Global Assembly Cache so that it can be activated from any COM Client. If the Assembly is only intended to be activated by a single application, you can put it in the application directory.

The following command registers all the public classes contained in mytest. dll.

Regasm mytest. dll
The following command generates the file mytest. Reg, which contains all necessary registry keys. This command does not update the registry.

Regasm mytest. dll/regfile: mytest. Reg
The following command registers all the public classes contained in mytest. dll and generates and registers the mytest. TLB library. This library contains the definitions of all the public types defined in mytest. dll.

Regasm mytest. dll/TLB: mytest. TLB

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.