Here’s a cryptic RegAsm Error you might see with VS.NET 2005

Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004.  All rights reserved.

RegAsm : error RA0000 : Could not load file or assembly 'MyAssembly, Version=0.0.
0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Exception
 from HRESULT: 0xE0434F4D

Now I know my assembly has version so this doesn't make sense....nor did the fact that using fuslogvw didn't show any assembly binding failures and filemon showed that the file is being located and read from without any problems.  Well, now what?  Create a simple .NET project (doesn't matter what), and set the debugging options to launch an external program (c:\windows\\framework\v2.0.50727\regasm.exe) and set the command line arguments to pass in the dll you're trying to register.  Also configure the debugger to break when excpetions are thrown.

Run the project and the IDE will break on the underlying exception that's causing the whole thing to bust.  In my case it was this exception:

      DLL 'MyAssembly.dllis attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

Comments (1)

  1. Alex Morse says:

    Hello, I’m receiving a similar message.  

    RegASM : error RA0000 : An error occured while writing the registration information to the registry.  You must have administrative credentials to perform this task.  Contact your system administrator for assistance.

    It seems straightforward, however this is when running as administrator.  I’ve only gotten the error on one PC, three others ran it fine.  Have you encountered anything like this?  I’ve searched MSDN and google, found one other person mentioning it, but no resolution.

Skip to main content