Problem registering a dll - Access Denied

7

When trying to run regasm in Win2008 Server:

regasm "C:\Program Files\FooProg\Bar.dll" /tlb:"C:\Program Files\FooProg\Bar.tlb"

I get the following error:

RegAsm : error RA0000 : An error occurred while saving the exported type library: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

what does this mean

regasm
dllregistration
asked on Stack Overflow Dec 4, 2009 by Vidar

11 Answers

13

That error mostlikely comes up because you can't delete a corresponding .tlb file. Two other suggestions:

  1. Stop IIS and attempt to register again:
  2. Stop IIS, remove .tlb files from wherever your DLL file is and then attempt to register again.
  3. Close all IE/IIS/DEV tools (they might be keeping some files in read-only state) and then attempt to register your DLL
answered on Stack Overflow Apr 7, 2010 by Dominik Ras
9

The account under which you run regasm doesn't have rights to write to C:\Program Files\FooProg\ and that's why regasm fails to write the .tlb. Run regasm under an account with administrator priviledges.

answered on Stack Overflow Dec 4, 2009 by sharptooth
3

The account you are using needs administrator privileges.

answered on Stack Overflow Dec 4, 2009 by scottm
1

That error mostlikely comes up because you can't delete a corresponding .tlb file. Two other suggestions: 1. Stop IIS and attempt to register again: 2. Stop IIS, remove .tlb files from wherever your DLL file is and then attempt to register again.

answered on Stack Overflow Apr 7, 2010 by Dominik Ras
1

In my case both the .dll and .tlb file were ReadOnly removing the ReadOnly check worked for me, also i have closed the process that was using it like(Visual Studio IDE).

answered on Stack Overflow May 2, 2011 by Shiva
1

You can also get this problem if you don't specify a full path in the /tlb argument.

It'll attempt to write to C:\windows\system32. Even if you run as Administrator, by default you don't have rights to write to that directory.

The solution is simply to provide a full path (to a directory you have rights to) in the /tlb argument.

answered on Stack Overflow Feb 4, 2013 by Ryan Lundy
1

More than likely you are getting the error due to a process having hooks into the .dll or .tlb file that you are trying to register or copy. Restart your machine and try again or delete the .tlb file and rebuild it to be sure you can access it.

answered on Stack Overflow Apr 9, 2013 by CDB
1

I had a stray dllhost.exe process. Killing it allowed me to delete the .tlb file and re-register. Other approaches (Stopping IIS, stopping application pools, closing all IDE's) had no effect.

answered on Stack Overflow Oct 3, 2014 by MPelletier • edited Jul 27, 2017 by MPelletier
0

First I had to remove all spaces in the path to my dll before regasm found the dll file.

But when I tried with quotation marks around the targets it worked anyway.

answered on Stack Overflow Oct 30, 2012 by autodidact • edited Oct 30, 2012 by autodidact
0

Win 7 (if are already administrator) - You can enable permissions for the file by right clicking and accessing properties, security tab, click edit, check on the allow for the permissions, e.g. Full control.

answered on Stack Overflow Nov 22, 2013 by Nasri Najib
0

For me, file was being used by other application


User contributions licensed under CC BY-SA 3.0