简体   繁体   English

由于 vmwp.exe 文件锁定,Visual Studio 构建在将文件复制到 bin 目录时失败

[英]Visual studio build fails while copying files to the bin directory due to file locks by vmwp.exe

I'm running my development environment in Docker containers.我在 Docker 容器中运行我的开发环境。 Since I have done some updates I'm now experiencing some difficulties when trying to rebuild my project that's running in my Docker container.由于我已经完成了一些更新,因此在尝试重建在 Docker 容器中运行的项目时遇到了一些困难。

My project is running in a Windows Server Core Docker container running IIS, and I'm running the project from a shared volume on my host.我的项目在运行 IIS 的 Windows 服务器核心 Docker 容器中运行,并且我正在从主机上的共享卷运行项目。 I'm able to build the project before starting the docker container, but after the docker container is started the build fails with the following error:我能够在启动 docker 容器之前构建项目,但是在启动 docker 容器之后构建失败并出现以下错误:

Could not copy "C:\path\to\dll\name.dll" to "bin\name.dll". Exceeded retry count of 10. Failed. The file is locked by: "vmwp.exe (22604), vmmem (10488)"

It seems that the Hyper-V process is locking the DLL files.似乎 Hyper-V 进程正在锁定 DLL 文件。 This clearly wasn't the case before and this seems to be related to some Docker or Windows updates I have done.这显然不是以前的情况,这似乎与我所做的一些 Docker 或 Windows 更新有关。 How can I solve this issue?我该如何解决这个问题? Do I need to change the process of building the application and running it in my Docker containers?我是否需要更改构建应用程序并在我的 Docker 容器中运行它的过程?

I have been searching for a while now, and I can't find much about this specific issue.我已经搜索了一段时间,但我找不到太多关于这个特定问题的信息。 Any help would be appreciated.任何帮助,将不胜感激。 Thanks in advance!提前致谢!

I've run in the similar problem.我遇到了类似的问题。 Solved by stopping/removing the running application container from docker-for-windows interface.通过从 docker-for-windows 界面停止/删除正在运行的应用程序容器来解决。 docker rm -f will also do. docker rm -f也可以。

  1. If you use Docker Windows Containers make sure you have at least Windows 10.0.1809 on both environment(your physical machine and on docker) -run CMDs and you will see on top of it.如果您在两个环境中使用 Docker Windows 容器,请确保您至少有 Windows 10.0.1809 在这两个环境(您的物理机器和它的顶部)上运行 CMD。
  2. Use isolation flag with process when you run docker: --isolation process.运行 docker 时对进程使用隔离标志:--isolation 进程。

On physical machine two vmxxx(lower and higher PID)(don't remember the name exactly) processes was keeping *.dll file(the build was going on docker side where build tools 2019 was used).在物理机上,两个 vmxxx(较低和较高 PID)(不记得确切名称)进程保留 *.dll 文件(构建在 docker 端进行,其中使用了构建工具 2019)。

Potential solution:潜在的解决方案:

  1. First MSbuild Error occurred because msbuild tries to delete file - access denied - probably this one vm process handle the file.第一个 MSbuild 发生错误,因为 msbuild 尝试删除文件 - 访问被拒绝 - 可能是这个 vm 进程处理文件。
  2. Second Msbuild Error occurred(the first vmxxx one caused that) showing that copy file from one direction to another it's not possible due to System lock (4).第二个 Msbuild 发生错误(第一个 vmxxx 导致该错误)表明由于系统锁定 (4),无法从一个方向复制文件到另一个方向。

Both vmxxx processes keeping those two dll files during build on docker.两个 vmxxx 进程在 docker 上构建期间保留这两个 dll 文件。 One vmxxx had higher number of PID and second had lower number of PID.一个 vmxxx 的 PID 数量较多,而第二个 vmxxx 的 PID 数量较少。

Isolation should take care of processes when you build project from docker container.当您从 docker 容器构建项目时,隔离应该注意流程。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由于缺少属性文件,MSBuild 无法构建 Visual Studio 项目(可能与 IDE 相关) - MSBuild fails to build Visual Studio Project due to missing property files (potentially IDE related) 由于不存在Dockerfile目录,Visual Studio发布到自定义Docker容器失败 - Visual Studio publish to custom Docker container fails due to non-existent Dockerfile directory Visual Studio:当链接文件在项目中时,docker 构建失败 - Visual Studio: docker build fails when linked files are in the project docker - 将文件复制到root时构建失败 - docker - build fails when COPYing file to root docker 构建文件复制文件带方括号 - docker build file copying files with square brackets 在 Visual Studio 中使用相同的 docker 文件构建 docker 映像的 Azure Pipeline 失败 - Azure Pipeline to build docker images fails using same docker file in Visual Studio 支持docker文件的Visual Studio - 没有这样的文件或目录 - Visual Studio with docker file support - no such file or directory docker-compose 构建失败,没有这样的文件或目录 - docker-compose build fails with no such file or directory Docker 构建映像失败 - 没有这样的文件或目录 - Docker build image fails - No such file or directory 在 docker build 中运行“/usr/local/bin/gunicorn”说“stat /usr/local/bin/gunicorn:没有这样的文件或目录” - Running "/usr/local/bin/gunicorn" in a docker build says " stat /usr/local/bin/gunicorn: no such file or directory"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM