zoukankan      html  css  js  c++  java
  • 【VS Error】VS2008在编译时出现:Error 15 Cannot register assembly

    现象

    在visual studio 2008在编译类库时提示如下错误:

    Error 15 Cannot register assembly "D:1_Work2_SVNOCRplatform runkcodeOCR.FileTransCommoninDebugOCR.FileTransCommon.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOTOCR.FileTransCommon.FileEntity' is denied. OCR.FileTransCommon

    MSDN解释

    Hello 

    Regsvr32, Regasm, and the registration method used by Visual Studio do not give the choice to register COM per-user because they have no per-user or per-system context, so they have to be elevated to register the component. 

    A possible workaround is to add a MSI setup project. An MSI setup can choose per-user or per-system because there is infrastructure that supports it at install time and gives the installing user a choice.

    1. uncheck the Register for COM interop option. 
    2. add a setup project (Other Project Types / Setup and Deployment / Setup Project)
    3. Right-click the Setup project, select Add / Project Output / Primary output of your COM project. 
    4. Select Primary output of your COM project in the Solution Explorer, and display its properties. Set the Register property to be vsdrpCOM. 
    5. By default, the setup project always gives the UAC dialog, even though you install it per user. To turn off UAC compilance, you need to use Orca, a tool provided by Windows SDK. 
    6. After you install and launch Orca, open the resulting msi file. 
    7. In the View menu, select Summary Information, and uncheck the UAC Compilant option. 
    8. Save and close Orca
    9. Run the setup project. Change the installation folder from the default C:/Program Files/... to a folder that is not restricted by UAC.

    Please let me know whether this works for you.

    Another option:

    1. still uncheck the Register for COM interop option.
    2. instead of using a msi setup project, use a .reg file to register COM component to per-user profile. You can prepare a .REG file with all needed regsitry keys for the COM component. Next, import regsitry by using the REG.exe tool:

    reg.exe import <your reg file>

    按照上述9步即可解决问题。

    或者终极方法:将类库项目右键->Properities->Build中的Register for COM interop选项去掉然后重新编译。

  • 相关阅读:
    聚合根、实体、值对象
    哀悼的CSS 把网站变成灰色
    Ubuntu13.04更换aptget源
    JS判断用户终端,跳转到不同的页面.
    分享一个使用的FireFox 截图插件小巧方便
    Linux 下面FireFox 看CCTV直播
    Ubuntu 11.10后 Guest账户禁用!
    修改Ubuntu的启动画面plymouth
    ubuntu开机自启动小键盘
    Linux 用cat做图片种子||Windows 用copy做图片种子
  • 原文地址:https://www.cnblogs.com/wangyblzu/p/5795878.html
Copyright © 2011-2022 走看看