1

I have a solution with 2 projects included: a WPF Applicatin and a ClassLibrary (tried both Standard and Framework template). The WPFApp references the ClassLibrary.

The problem is: when I try to build the solution I get the following error:

Unable to copy file "obj\Debug\ClassLibrary.dll" to "bin\Debug\ClassLibrary.dll". The process cannot access the file 'bin\Debug\ClassLibrary.dll' because it is being used by another process.

If I end the MSBuild.exe process, everything works fine (until I change something on the ClassLibrary and try to build the solution)

I tried pre and post-build events with

taskkill /F /IM MSBuild.exe

But it doesn't work, just got some new errors. I guess it's due to MSBuild closing itsefl.

Do you have any idea of how to deal with that problem or at least what is the reason of such MSBuild behavior?

appa yip yip
  • 1,404
  • 1
  • 17
  • 38

1 Answers1

3

It seems that FodyWeaver is causing the issue.

Quote from the project page on GitHub:

Not Supported:

[...]

I think that Fody just messes up with the build process. Maybe it does something like a build task (as @Crowcoder suggested) and thus MSBuild locks the dll.

After switching back to packages.config problem disappeared.

appa yip yip
  • 1,404
  • 1
  • 17
  • 38
  • Not all package owners have tested their packages with the new model, so such issues can happen. You might report to Fody guys so that they might fix in a future release. – Lex Li Sep 07 '17 at 22:47