Program to register classes in. Net Assembly into COM classes

Source: Internet
Author: User

Program to register classes in. Net Assembly into COM classes

Recently, you need to right-click IE to add a custom menu item in the context menu and respond to it.

Therefore, you must register. Net Assembly as a COM class.

Of course, manual use of a series of command lines can be achieved:

See QuickStart interactive operations> Generate. net com servers that can be called from the COM Client:

Http: // localhost/quickstart/howto/doc/Interop/Building_Samples_COM2NET.aspx

Of course, it is difficult to use Process to call tlbexp.exe‑gacutil.exe‑regasm.exe and other command line implementations!

In fact, there is a simpler method, which can be done in two sentences:

System. incluiseservices. Internal. Publish P = new System. incluiseservices. Internal. Publish ();

// P. GacInstall (asmFile );

P. RegisterAssembly (asmFile );

System. Windows. Forms. MessageBox. Show ("OK ");

The download contains a complete set of Solution:

Http://files.cnblogs.com/Microshaoft/RegAsm2Com.rar


1. Asm4ComApplication: an application to be installed

2. RegAsm2ComInstaller: it is a console application that contains a Custom installation program class (Custom Action Installer ).

3. Setup1: the installation project used to install Asm4ComApplication


The Setup provides the following functions:

1. Register. Net Assembly as a COM class

(In addition, the Setup installation project:

"Application folder"-> "File Installation properties"-> "Register" [vsdraCOM, vsdraCOMRelativePath]

You can also register. Net Assembly directly into a COM class during installation without programming)

2. Right-click IE to add a custom menu item (Microshaoft displays Img Src Url) and respond

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.