Error PRJ0050 - Failed to register output - Ensure you have permissions to modify the registry

来源:互联网 发布:ubuntu安装gfirefly 编辑:程序博客网 时间:2024/04/30 16:25

This nasty looking error, you might get under VS 2005, often maybe more annoying than harmful. The scenario I describe below may not account for all occurrences of this error, but it might be rather frequent. When you start a project in most cases you rely on the wizard, and when building a COM component, the wizard will create and add an idl file to your project, and generate internal command to invoke MIDL compiler to produce a type library. Some developers don't always need the type library, or even the idl, because their component is specialized and don't need to be advertised to the general COM public. Thus, they may remove those. However, the wizard generated DllRegisterServer() function calls the module's DllRegisterServer() without specifying an argument for the optional BOOL bRegTypeLib, which then assumes its default value of TRUE. As a consequence, when RegSvr32.exe is invoked by the VS build tool, it tries to register also the type library, after registering the module's COM objects. The ATL code tries to locate the type library first inside the dll, and if that fails by locating the tlb file with the root name identical to the binary module. I have read some developers complain that the error may popup sometime and sometime not. It maybe that the tlb file might have been lingering in the folder from the previous compilations and thus was found. In any case to fix the problem provide explicitly FALSE as the argument to both DllRegisterServer(FALSE) and DllUnregisterServer(FALSE), if you don't have the type library.