现象

在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. 5个基于Linux命令行的文件下载和网站浏览工具

    导读 命令行是GNU/Linux中最神奇迷人的部分,它是非常强大的工具;命令行本身功能多样,多种内建或者第三方的命令行应用使得Linux变得更加健壮和强大.Linux Shell支持多种不同类型的网络 ...

  2. poj_3628 动态规划

    题目大意 有N个数字,大小为a[i], 给定一个数S,用这N个数中的某些数加起来使得结果sum>= S,且sum-S最小,求该最小的sum-S值. 题目分析 题意中可知,这N个数字的和肯定大于S ...

  3. Visual Studio Code 配置 gulp

    原本用的webstorm部署的gulp,后来由于太卡,打算换个编辑器,考虑了一番,之前用的是sublime,配置很是麻烦,最新听说饥人谷老师用的是vsCode,所以打算尝试一下这个编辑器,安装还是很方 ...

  4. handlebears使用

    Handlebars 文档笔记: http://www.ghostchina.com/handlebars-wen-dang-bi-ji/ Handlebars模板引擎中的each嵌套及源码浅读: h ...

  5. 【BZOJ2726】[SDOI2012]任务安排 斜率优化+cdq分治

    [BZOJ2726][SDOI2012]任务安排 Description 机器上有N个需要处理的任务,它们构成了一个序列.这些任务被标号为1到N,因此序列的排列为1,2,3...N.这N个任务被分成若 ...

  6. [NOIP2017]列队 离线+SBT

    [NOIP2017]列队 题目描述 Sylvia 是一个热爱学习的女♂孩子. 前段时间,Sylvia 参加了学校的军训.众所周知,军训的时候需要站方阵. Sylvia 所在的方阵中有n×m名学生,方阵 ...

  7. cx_Oracle在sublime text里运行遇到 ImportError错误解决办法

    如果你装完cx_Oracle之后,命令行运行没错,但是在sublime text里运行, 就遇到这个错误: ImportError: dlopen(/Library/Python/2.7/site-p ...

  8. vue 阻止表单默认的提交事件

    form <form autocomplete="off" @submit.prevent="onSubmit"> <input type=& ...

  9. spring boot 加载jsp

    1.spring boot启动类继承SpringBootServletInitializer ,并且重写configure方法 package com.springapp.mvc;import jav ...

  10. 170426、centos6.5安装 Zookeeper注册中心

    注册中心服务器(192.168.3.71)配置,安装 Zookeeper: 1. 修改操作系统的/etc/hosts 文件中添加: # zookeeper servers 192.168.3.71 r ...