问题
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
回答1:
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.
回答2:
That error mostlikely comes up because you can't delete a corresponding .tlb file. Two other suggestions:
- Stop IIS and attempt to register again:
- Stop IIS, remove .tlb files from wherever your DLL file is and then attempt to register again.
- Close all IE/IIS/DEV tools (they might be keeping some files in read-only state) and then attempt to register your DLL
回答3:
The account you are using needs administrator privileges.
回答4:
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.
回答5:
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).
回答6:
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.
回答7:
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.
回答8:
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.
回答9:
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.
回答10:
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.
回答11:
For me, file was being used by other application
来源:https://stackoverflow.com/questions/1847763/problem-registering-a-dll-access-denied