.net Visual Studio 2012 警告 MSB3026:无法复制 DLL 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15689353/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 12:11:08  来源:igfitidea点击:

Visual Studio 2012 warning MSB3026: Could not copy DLL files

.netasp.net-mvcvisual-studiovisual-studio-2012signalr

提问by Oxon

I keep getting:

我不断得到:

warning MSB3026: Could not copy dlls errors.

警告 MSB3026:无法复制 dll 错误。

I have several projects in the solution.

我在解决方案中有几个项目。

On build, I also get the error:

在构建时,我也收到错误:

Error 47 Could not copy "myapp\bin\Debug*.dll" to "bin*.dll". Exceeded retry count of 10. Failed.

错误 47 无法将“myapp\bin\Debug*.dll”复制到“bin*.dll”。超过 10 次重试次数。失败。

The application just stops responding in the middle of debugging, and I have to close Visual Studio every time. Which was annoying, but now it's getting frustrating as well.

应用程序只是在调试过程中停止响应,我每次都必须关闭 Visual Studio。这很烦人,但现在也越来越令人沮丧。

We are eight team members, and all of us are getting the same error. We can't rebuild the solution, and the application is running very slow.

我们有八名团队成员,我们所有人都遇到了同样的错误。我们无法重建解决方案,并且应用程序运行非常缓慢。

One of things we are using in the project is SignalR.

我们在项目中使用的一件事是SignalR

These are the things I have tried so far. They didn't help me, but they might help the reader:

这些是我迄今为止尝试过的事情。他们没有帮助我,但他们可能会帮助读者:

  1. I have tried solutions described in Visual Studio debugging/loading very slow, but that didn't work.

  2. I have also tried unchecking Enable the Visual Studio hosting process in each project properties and that didn't fix the issue either.

  3. Solutions are described in http://www.richard-banks.org/2008/04/how-to-fix-problems-with-locked-files.htmland http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/40ed753e-47af-4638-8a72-1d607102a05c/

  4. Pre-build scripts on the projects: if exist "$(TargetPath).locked" del "$(TargetPath).locked" if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

  5. The bin folders are not under source control.

  6. Sometimes killing the Microsoft.VisualStudio.Web.Host.exe process releases the lock on the files, but this does not always work.

  7. I am running Visual Studio in administrator mode.

  8. I have full access (permissions read/write) on the source code folders.

  1. 我已经尝试过Visual Studio 调试/加载非常慢中描述的解决方案,但没有奏效。

  2. 我还尝试在每个项目属性中取消选中启用 Visual Studio 托管进程,但也没有解决问题。

  3. http://www.richard-banks.org/2008/04/how-to-fix-problems-with-locked-files.htmlhttp://social.msdn.microsoft.com/Forums/中描述了解决方案en-US/msbuild/thread/40ed753e-47af-4638-8a72-1d607102a05c/

  4. 在项目上预构建脚本: if exist "$(TargetPath).locked" del "$(TargetPath).locked" if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

  5. bin 文件夹不受源代码控制。

  6. 有时杀死 Microsoft.VisualStudio.Web.Host.exe 进程会释放对文件的锁定,但这并不总是有效。

  7. 我在管理员模式下运行 Visual Studio。

  8. 我对源代码文件夹具有完全访问权限(读/写权限)。

回答by Chris Pratt

This is generally a permissions issue with your bin directory. Navigate to it in Windows Explorer and make sure readonly is off. If you get an error changing the read status of the directory, make sure you're running on an administrator-level account or elevate accordingly. Once write permissions are re-enabled, your build should work fine.

这通常是您的 bin 目录的权限问题。在 Windows 资源管理器中导航到它并确保只读已关闭。如果您在更改目录的读取状态时遇到错误,请确保您使用管理员级别的帐户运行或相应提升。重新启用写入权限后,您的构建应该可以正常工作。

回答by Scott Solmer

Clean Solution, then Rebuild Solution fixed this issue for me.
The first time I tried to perform a Clean, I got an access violation error.
To remedy that, I exited VS, manually deleted the bin folder, and opened it back up. Then I could perform the Clean.

清理解决方案,然后重建解决方案为我解决了这个问题。
我第一次尝试执行清理时,出现访问冲突错误。
为了解决这个问题,我退出了 VS,手动删除了 bin 文件夹,然后重新打开它。然后我可以执行清洁。

This had nothing to do with permissions or access level.
Ensuring the output directory was not read-only and running VS as Admin did not help.

这与权限或访问级别无关。
确保输出目录不是只读的并且以管理员身份运行 VS 也无济于事。

Please refer to Visual Studio “Could not copy” … during build.

请参阅Visual Studio“无法复制”……在构建过程中

回答by iusmar

I had this issue several days ago and tried many approaches but the solution that worked for me was stopping a windows service that was used by some class libraries from the project.

几天前我遇到了这个问题并尝试了很多方法,但对我有用的解决方案是停止项目中某些类库使用的 Windows 服务。

回答by Dano

I ran into this issue as well, seems like a known bug in VS that randomly gets people from time to time in 2010, 2012 and 2013, I tried many of the suggestions here, as well as few found on other sites, none worked. What helped me was going into the debug properties for the project and clearing "Enable Visual Studio Hosting process", rebuild all and no more error.

我也遇到了这个问题,似乎是 VS 中的一个已知错误,它在 2010 年、2012 年和 2013 年时不时地让人们看到,我在这里尝试了许多建议,以及在其他网站上找到的建议很少,但都没有奏效。帮助我的是进入项目的调试属性并清除“启用 Visual Studio 托管进程”,重新构建所有内容,不再出现错误。

Hopefully this will work for you, but that said, as it is a known reported bug in VS itself, we might all be fixing the symptoms and luckily doing something to clear the file lock and the real problem remains in VS.

希望这对你有用,但也就是说,因为它是 VS 本身中一个已知的报告错误,我们可能都在修复症状,幸运的是做一些事情来清除文件锁定,而真正的问题仍然存在于 VS 中。

回答by Redone

I had the same issue. It seems that the dlls visual studio trying to copy is corrupt or something like that. I tried to copy the particular dlls to my desktop but it failed with error message. So I replaced the entire dlls with the fresh ones, which solved my problem. Hope that helps.

我遇到过同样的问题。似乎试图复制的 dll 视觉工作室已损坏或类似的东西。我试图将特定的 dll 复制到我的桌面,但失败并显示错误消息。所以我用新的 dll 替换了整个 dll,这解决了我的问题。希望有帮助。

回答by MrBootAndTheBuilding

This worked for me:

这对我有用:

  1. Close VS
  2. Delete bin and obj folders.
  3. If the project is located in any cloud-service-synced folder like OneDrive, move it to a local, regular folder.
  4. Delete .suo file inside solution folder
  5. Open VS again and rebuild.
  1. 关闭VS
  2. 删除 bin 和 obj 文件夹。
  3. 如果项目位于 OneDrive 等任何云服务同步文件夹中,请将其移动到本地的常规文件夹中。
  4. 删除解决方案文件夹中的 .suo 文件
  5. 再次打开VS并重建。

Some similar issues deal with the dlls being locked so they cannot be copied, in which case, help can be found hereand here!

一些类似的问题涉及 dll 被锁定,因此无法复制它们,在这种情况下,可以在此处此处找到帮助!

回答by Ryan Young

Same issue for me. Solution was that I had my debugger still running the program in the background.

对我来说同样的问题。解决方案是我的调试器仍在后台运行程序。

回答by Vinoth

I had the same issue.Clear the browser history and build the project. which solved my problem. Hope that helps.

我有同样的问题。清除浏览器历史记录并构建项目。这解决了我的问题。希望有帮助。

回答by Jonathan Robbins

This issue had been plaguing my development for sometime. Regardless of disabling the Read Only security permission and modifying access rights of the affect dlls.

这个问题一直困扰着我的发展一段时间。无论禁用只读安全权限和修改受影响的 dll 的访问权限。

I resolved the issue by ensuring the Security Permissions on the parent folder of solution allowed the computer's administrator read and write access and then ran Visual Studio in Administrator mode.

我通过确保解决方案的父文件夹上的安全权限允许计算机管理员读写访问,然后在管理员模式下运行 Visual Studio 来解决该问题。