C# 在 Visual Studio 2005 中构建解决方案时访问被拒绝错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/81071/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Access denied error when building solution in Visual Studio 2005
提问by Stuart Grassie
I get the following error in Visual Studio 2005 when doing a build:
执行构建时,我在 Visual Studio 2005 中收到以下错误:
Error 9 Cannot register assembly "E:\CSharp\project\Some.Assembly.dll" - access denied. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) project
错误 9 无法注册程序集“E:\CSharp\project\Some.Assembly.dll” - 访问被拒绝。访问被拒绝。(来自 HRESULT 的异常:0x80070005 (E_ACCESSDENIED))项目
It happens only intermittantly and does go away if I restart the IDE, however this is incredibly annoying and I would like to put a stop to it happening permanently, if I can. I've checked the assembly itself, and it is not set to read only, so I've no idea why Visul Studio is getting a lock on it. I am working in Debug mode.
它只会间歇性地发生,如果我重新启动 IDE,它就会消失,但是这非常烦人,如果可以的话,我想永久停止它的发生。我已经检查了程序集本身,它没有设置为只读,所以我不知道为什么 Visul Studio 会锁定它。我在调试模式下工作。
I've had a look around google, but can't seem to find anything other than "restart VS". Does anyone have any suggestions as to how I can resolve this annoying problem?
我环顾了谷歌,但似乎除了“重启VS”之外找不到任何其他东西。有没有人对我如何解决这个烦人的问题有任何建议?
回答by Raithlin
It sounds like you have a DLL that gets locked every now and then, preventing VS from overwriting/locking it. Have you tried using tools like Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx), or Unlocker (http://www.emptyloop.com/unlocker/) to see what is locking the DLL? Unlocker in particular has saved me many a time.
听起来您有一个不时被锁定的 DLL,以防止 VS 覆盖/锁定它。您是否尝试过使用 Process Explorer ( http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) 或 Unlocker ( http://www.emptyloop.com/unlocker/) 等工具来查看是什么锁定DLL?特别是 Unlocker 为我节省了很多时间。
As noted in the comments below (Thanks Jeff), you can also kill an individual lock from within Process Explorer.
正如下面的评论中所指出的(感谢Jeff),您还可以从 Process Explorer 中取消单个锁。
回答by AlainD
This may be caused by Visual Studio requiring administrator rights on Windows 7 or higher. To check, see whether the registry key mentioned below is set. If not, copy into a .reg
and merge. Be sure to check that your Visual Studio 2005 installation path in the .reg
file is correct!
这可能是由于 Visual Studio 需要 Windows 7 或更高版本的管理员权限造成的。要检查,请查看是否设置了下面提到的注册表项。如果没有,复制到 a.reg
并合并。请务必检查文件中您的 Visual Studio 2005 安装路径.reg
是否正确!
Windows Registry Editor Version 5.00
; Run Visual Studio 2005 with administrator rights
; This is required to run / debug the program directly from the IDE
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\devenv.exe"="~ RUNASADMIN"