现象

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

Error 15 Cannot register assembly "D:\01_Work\02_SVN\OCRplatform\trunk\code\OCR.FileTransCommon\bin\Debug\OCR.FileTransCommon.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\OCR.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选项去掉然后重新编译。

【VS Error】VS2008在编译时出现:Error 15 Cannot register assembly的更多相关文章

  1. android 6.0编译时出现ERROR:Security problem ,see jack server log【转】

    本文转载自:http://blog.csdn.net/a567890k/article/details/52956798 最近编译Android6.0时经常出现以下错误 临时解决方法: Buildin ...

  2. 解决办法:CMake编译时出现“error in configuration process project files may be invalid”

    无论是CMake2.84 还是当前最新的CMake2.87都可能会出现这种错: 查遍国内外的网上都没有给出可行办法,结果还是自己解决了 现把出错原因和解决办法如下:出错原因:因是英文版本,通常安装没有 ...

  3. 升级到JDK8,编译时发生 Error:java: java.lang.ExceptionInInitializerError

    编译的时候出现这个问题.使用1.7的jdk没问题,但是由于po主的项目中,使用了java8编写的代码,解决java8兼容问题成为解决这个问题的首选方案. 这个日志太过简单,只告知一个异常信息,这个异常 ...

  4. Vue使用Typescript开发编译时提示“ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'afterCompile' of undefined”的解决方法

    使用Typescript开发Vue,一切准备就绪.但npm start 时,提示“ ERROR in ./src/main.tsModule build failed: TypeError: Cann ...

  5. 《OpenGL编程指南第七版》学习——编译时提示“error C2381: “exit” : 重定义;__declspec(noreturn) 不同”错误的解决办法

    解决办法一. #if defined(_WIN32) # ifndef GLUT_BUILDING_LIBextern _CRTIMP void __cdecl exit(int); 上面是glut. ...

  6. libevent在windows下用visual studio编译时出现error C2894错误的原因与解决方法

    libevent是一个使用很广泛的网络库,今天想了解下它.于是去git clone了一份源码,用vs2005的命令行:nmake -f makefile.nmake编译之,顺利编译通过,生成三个静态库 ...

  7. php安装编译时 configure: error: Cannot find OpenSSL's <evp.h>

    =============================================== yum install error: protected multilib versions error ...

  8. make only output error/warning message( 编译时,只输出错误信息和警告信息)

    make > /dev/null 这样,正常的信息被重定向输出到/dev/null,错误和警告信息会输出到标准错误设备(standard error,相对于标准输入/输出设备来说).

  9. Qt 编译时遇到 error: [debug/qrc_music.cpp] Error 1

    第一种方式,清理编译文件 把Qdebug release 文件件都删除, 删除makefile 文件 尝试重新编译 以上是网上寻找的结果 以下是我的解决方法 如果还抱错,请检查qrc文件是否存在异常 ...

随机推荐

  1. Tiny4412 Android 5.0 编译系统学习笔记

    1.Android 编译系统概述 Build 系统中最主要的处理逻辑都在 Make 文件中,而其他的脚本文件只是起到一些辅助作用. 整个 Build 系统中的 Make 文件可以分为三类: ① Bui ...

  2. flex布局,input点击软键盘激活,底部按钮上移

    安卓手机的问题,原本表单没有超出一屏的时候,上移的现象也是存才的,只是需要滑动body才能看得到,现在,超出一屏了,现象就很明显了 body明显上移: 点击input修改价格: 软键盘出现: 先尝试了 ...

  3. axios post传参后台无法接收问题

    起因是在angular项目中使用axios发送post请求,向后台传参后台一直无法接收,网上查了有说是请求头设置不对,需要把Content-Type:application/x-www-form-ur ...

  4. rabbitmq 用户管理

    rabbitmqctl add_user root cor2016 rabbitmqctl set_user_tags root administrator http://host:15672/#/u ...

  5. Python--进阶处理7

    # ====================第七章:函数========================= # 为了能让一个函数接受任意数量的位置参数,可以使用一个* 参数# 为了接受任意数量的关键字 ...

  6. Hibernate的二级缓存(SessionFaction的外置缓存)-----Helloword

    1. 使用 Hibernate 二级缓存的步骤: 1). 加入二级缓存插件的 jar 包及配置文件: I. 复制 \hibernate-release-4.2.4.Final\lib\optional ...

  7. Android 满屏显示自定义的View,并进行移动

    新建一个类,继承View package com.topcrab.mygame; import android.content.Context; import android.graphics.Bit ...

  8. python在处理CSV文件时,字符串和列表写入的区别

    概述 Python在处理CSV文件时,如果writerow的对象是<type 'unicode'>字符串时,写入到CSV文件时将会出现一个字符占一个单元格的情况: 但是将字符串转换为列表类 ...

  9. python web框架 django 添加环境变量

    C:\Users\Administrator.QH-20170325TNQR\AppData\Local\Programs\Python\Python36\Scripts把环境变量加上 可以在本地执行 ...

  10. rabbitMQ基本概念

    一.网页登录方法 http://127.0.0.1:15672/ 用户名和密码默认为guest/guest 用java代码去连接rabbitmq用的端口是5672 二.rabbitMQ基本概念 Rab ...