1
votes

from time to time when I publish my visual studio 2017 projects I get the "the process cannot access the file" error on some of the dll's . The error is pasted below. Does anyone know what is causing this.

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\Web\Deploy\Microsof t.Web.Publishing.Deploy.FileSystem.targets(96,5): error : Copying file obj\Debug\Package\PackageTmp\bin\EntityFramework .dll to C:\Websites\MyWebsite\bin\EntityFramework.dll failed. The process cannot access the file 'C:\Websites\ MyWebsite\bin\EntityFramework.dll' because it is being used by another process.

  • There is no pattern on the occurance of this error. It occurs randomnly on different dll files.
  • When this error occurs, I restart my visual studio / computer and then try another publish and it starts working.

Does anyone know what would be a permanent solution to fix this?

1

1 Answers

0
votes

Before you publish, select target location different from default location. This will avoid "the process cannot access the file"