Saturday, 14 September 2013

Using .net dll into COM

Some time back I had a situation where I had to use a .Net dll into an classic ASP application. The questin was how the .net dll will be identified by asp application.

Here are the steps to follow to make a dll work in ASP application:
1. Add [ComVisible(true)] attribute to the class, method or at assembly level to make that code COM interop enabled. Or simply go to the project properties tab-> Application  -> Assembly Information and check the ComVisible checkbox.



2. Sign the assembly with strong name key. If you are very new to the .net world and have no idea how to sign an assembly with strong name key, please read my blog Signing an assembly with strong name key.

3. Move the assembly to the deployment machine and regiter into GAC with command gacutil -i [assembly path] on visual studio command prompt.

 2. Run the command regasm [assembly path]" on deployment machine on visual studio command prompt.

Yes, your dll ir ready for COM interop and to be used with ASP application.  

Moreover you can write these commands into a batch file and execute with a single click and keep for future use as well.

No comments:

Post a Comment