PostBuild event不能注册到全局缓存解决办法

在Win 7系统上的VS2010跑一个以前写的程序,编译时报错“Error    8    The command ""路径\gacutil.exe" /i "路径\CommonSupport.dll"" exited with code 1.”。因为工程有Post-Build事件,生成后调用Gacutil注册到GAC,以控制台窗口运行该注册命令,系统报“Failure adding assembly to the cache: Access denied. You might not have administrative credentials to perform this task. Contact your system administrator for assistance.”错误,原来是Windows的UAC设置引起的。

解决方法:

打开VS2010安装目录,选择devenv.exe,右键属性,兼容性选项卡,勾选特权等级下的“以管理员身份运行此程序”。重启VS2010,重新Build程序,成功注册到GAC。

原文地址:https://www.cnblogs.com/jeet/p/2087357.html