Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to register a .NET assembly as COM?

I have created a class library for a workflow on a local machine and build that. I moved the complete solution to a Tridion server and tried to register the assembly in the server using regasm.exe tool as below:

C:\User\XYZ\Desktop\>RegAsm \codebase F:\Workflow\WorkflowHandler/bin/debug/WorkflowHandler.dll 

I got the following error:

failed to load 'F:\Workflow\WorkflowHandler/bin/debug/WorkflowHandler.dll ' because it is not a valid .NET Assembly.

My server details:

64-bit, Windows Server 2008 R2 Enterprise, and .NET Framework 4 installed.

like image 275
user1428019 Avatar asked Jul 04 '12 04:07

user1428019


People also ask

How can you register a .NET assembly?

You can run a command-line tool called the Assembly Registration Tool (Regasm.exe) to register or unregister an assembly for use with COM. Regasm.exe adds information about the class to the system registry so COM clients can use the . NET Framework class transparently.

How do I register a COM object?

To register an in-process or out-of-process ActiveX server (DLL, OCX, or EXE), choose either: Run > ActiveX Server > Register. Run > ActiveX Server > Register for Current User.

How do I register Regasm exe?

By dragging and dropping the dll onto 'regasm' you can register it. You can open two 'Window Explorer' windows. One will contain the dll you wish to register. The 2nd window will be the location of the 'regasm' application.


1 Answers

Are you sure you have the right RegAsm in your path since you're calling it by exe name only without specifying the full path? You must call the right version of RegAsm for it to work, i.e 32 or 64-bit version of .NET 4.

Try specifying the full path:

c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /codebase F:\Workflow\WorkflowHandler\bin\debug\WorkflowHandler.dll 

or

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe /codebase F:\Workflow\WorkflowHandler\bin\debug\WorkflowHandler.dll 

Also I noticed that in the path to your assembly you had some / characters instead of \. Make sure you're putting in the correct path.

like image 125
Damir Arh Avatar answered Sep 27 '22 21:09

Damir Arh