2

I have a C++ project that calls RegAsm in the pre-build event for a couple of assemblies. The pre-build event fails with following error:

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

When I checked the BuildLog.htm it has following command in the pre-build event:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm 
    ../../../CommonLib/release/Services.dll 
    /tlb:c:\TFS\Console\Solution\Bridge\Services.tlb

So I copied the command and ran it in the Visual Studio 2010 command prompt as Administrator but got the same error.

I used to be able to build this project fine until recently. Not sure what is causing this problem. Any help is appreciated.

I am part of Administrators group on this computer and have turned off the UAC.

ashtee
  • 993
  • 1
  • 7
  • 10

5 Answers5

2

open cmd by right click then "run as administrator"

abhinav
  • 21
  • 2
1

Check and see if the file is locked by another process. You can check by using the Sysinternals Process Monitor tool to ensure that the file is not locked or in use by another process. It combines the features of two legacy Sysinternals utilities, Filemon and Regmon

Also, check out this similar question on StackOverflow

Community
  • 1
  • 1
SoftwareCarpenter
  • 3,835
  • 3
  • 25
  • 37
  • Thanks for replying. The link that you provided does not apply to my situation. I am getting registry related error. Also, the file is not locked. I was able to delete the file and get latest version from the TFS (the Services.dll is in TFS). I also removed the readonly flag, just in case. But it does not work. – ashtee Jul 09 '12 at 17:32
  • 1
    Has your build machine changed to 64 bit by chance? If so try regasm from C:\Windows\Microsoft.NET\Framework64\v2.0.50727 – SoftwareCarpenter Jul 10 '12 at 18:15
  • Also, go to the registry and see what is currently registered and determine if you can actually set the guid value or remove it completely. Good luck. – SoftwareCarpenter Jul 15 '12 at 02:19
1

Sorry for cross posting, but this came up on google first, so I am keeping the answers up to date.

I have had the same problem here but with the opposite target platform. I solved it by running the x86 version of regasm, instead of the x64. It may work the other way round for you? so in instead of

C:\Windows\Microsoft.NET\Framework\v2.0.50727>regasm.exe

use x64 bit version at

C:\Windows\Microsoft.NET\Framework64\v2.0.50727>regasm.exe
Dai Bok
  • 3,451
  • 2
  • 53
  • 70
0

Well I have solved this by adding the "Full Control" Permissions on the HKEY_CLASSES_ROOT key (a bit rudimentary, but it worked) for the user which I was currently logged on. I have ran the elevated cmd, my user is in the "Administrators" group, but it seems that these were not enough.

0

Open Your VS as Administrator. It clearly says some permissions are denied. To get that to work, you have to make sure that you have opened it in Admin mode.

Mahmood Dehghan
  • 7,761
  • 5
  • 54
  • 71