1
votes

I am using Visual Studio(C++) 2010 to build a DLL project. The generated DLL is a normal DLL and I do not need to register it before using it.

However, when building the DLL project, I will always get the following error message

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(744,5): warning MSB3075: The command "regsvr32 /s "E:\Projects\MyDLL\Release\MyDLL.dll"" exited with code 5. Please verify that you have sufficient rights to run this command.

The previous error was converted to a warning because the task was called with ContinueOnError=true.

Build continuing because "ContinueOnError" on the task "Exec" is set to "true".

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(756,5): error MSB8011: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions.

Build FAILED.

The problem is strange in that:

  1. I do not have a post-build command ask Visual Studio to register DLL.
  2. I am the Administrator so should have enough permission even to register the DLL.

Please help. Thanks

1
Everything about this error message yells that you do in fact need to register this DLL. It found a way to do so, but failed because VS is not running elevated so regsvr32.exe could not write to the registry. So at least fix that problem first and see what hits the fan next. Right-click the VS shortcut and select "Run as administrator". With the expectation that this now works, you need to describe your project better to get the real help you need. - Hans Passant
Agree with ^Hans. Error 5 means that DllRegisterServer() was found in your executable, and calling that caused an "Access Denied" error. If the DLL didn't have a DllRegisterServer, it couldn't have been called and couldn't have returned error code 5. Still, I'm always surprised by Visual Studio wanting to register DLL's. That really is the task of the installer, not the compiler. - MSalters

1 Answers

4
votes

You can turn this off in project properties under Linker, Register Output:

C++ project properties, Linker, Register Output