Thursday, March 29, 2012

Failed to open malformed assembly 'MyAssembly' with HRESULT 0x80040154

Hello,

I wrote SQL Stored Procedures in C# and I am trying to register the asembly with SQL Server 2005 (Express Edition) using CREATE ASSEMBLY statment. I get this following error.

"Failed to open malformed assembly 'MyAssembly' with HRESULT 0x80040154"

Does anyone know how to solve this problem? It is driving me nuts for the last few days. I did enable CLR for SQL Server and also tried re-install SQL Server, but still I get this error.

Thanks in Advance,

Ravi

If this is an OLE/COM Stored Procedure, you need to create it using sp_OaCreate, rather than Create Assembly. Create Assembly is only for pure CLR based stored procedures. Also, using sp_OaCreate to load CLR based code in SQL Server is not supported: http://support.microsoft.com/kb/322884, so it is recommended that you transition your SP to a CLR based SP that does not rely on COM.

Steven

|||

Hi Steven,

Thanks for the reply. Its is a pure .NET Managed code assembly. It only does simple database operations, I didnt even have any new assemblies referenced also other than the ones Visual Studio adds by default ex: System, System.Data. The same assembly works in a differenct computer.

Ravi

|||

Hi Ravi,

Do you get the same error message when creating a different assembly? Perhaps, could you try one of the CLR samples from the BOL samples available here and let me know what happens? http://www.codeplex.com/MSFTEngProdSamples

Thanks,

Steven

|||

Yes, I get the same error for any assembly I create, I will try these samples and let you know.

Thanks,

Ravi

No comments:

Post a Comment