简体   繁体   中英

install a c# com dll for use by vbscript classic asp website

I have a Classic ASP website with vb6 dll's and all is ok with the world, but now I have some extra functionality that has been completed using c# into a COM DLL. In the dev environment this is working, but now I wish to move this DLL onto another machine.

My question is what is the best way to do this?

I have seen answers such as "add it to the GAC" or, "in needs a strong name", etc.

What happened to the good old regsvr32?

Regsvr32 is still relevant today but you can't use it with .NET, only native DLLs. .NET has a special way to register COM-types as we shall soon see.

Regsvr32 works by invoking the DllRegisterServer export. DllRegisterServer gives the library a chance to register COM classes; type libraries; interfaces etc. This export is not present in .dlls created by .NET which makes sense because they are not COM by default. You can easily see these differences if you open up a .NET or non-.NET .dll in Dependency Walker/Viewer .

Here's a native c++ ActiveX dll I made earlier (Note the DllRegisterServer export on the right):

在此处输入图片说明

And here is a managed .dll. (Note there are no exports let alone DllRegisterServer):

在此处输入图片说明

If you have marked your c# class as COM-visible then you can complete the COM-registration by invoking:

regasm assemblyFile [options]

Tell me more

This will place the necessary entries into the Windows Registry.

There is no need for the GAC because native COM clients (VB6) do not use the GAC

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM