0

When I build any of my WPF App projects, I often get this error:

"Unknown build error, 'The process cannot access the file '...\obj\Debug\GeneratedInternalTypeHelper.g.cs' because it is being used by another process.'"

In order to make the error go away, I must rebuild the project. Sometimes, the error persists, even if I rebuild many times. As far as I can tell, both its occurrence and its disappearance seem to be random.

A similar bug is reported here: Build error: "The process cannot access the file because it is being used by another process". That's a different problem because it concerns the project executable, while mine concerns GeneratedInternalTypeHelper.g.cs. Nevertheless, I've tried most of the suggestions posted there, including:

  • Switch from Debug to Release and back (or vice versa)
  • Close all designer windows before building
  • Use Task Manager to close all instances of MSBuild.exe
  • Manually delete GeneratedInternalTypeHelper.g.cs
  • Restart Visual Studio

None of these measures reliably resolve the error. Can anyone suggest what else I might try?

Edit:

Solved. The problem was an extension called FastFind. The suggestion to run Visual Studio in SafeMode was the advice I needed. Thanks to everyone who posted a comment.

Further Edit:

I reported the problem to the developers of FastFind, and they fixed it in an update. Kudos to them.

7
  • 2
    Have you tried running VS in administrator mode, and trying rebuild all? If that helps the situation, then that would give a hint as to why the problem is cropping up, IMHO. Also worth trying: Solution->Clean All. Commented Dec 20, 2017 at 23:11
  • On your suggestion, I tried running Visual Studio in administrator mode. Unfortunately, that doesn't seem to make any difference -- I still get the error. Likewise, cleaning the solution doesn't seem to help. Commented Dec 20, 2017 at 23:41
  • Look i know this is trivial, in the case there is a process hanging around, have you tried turning the pc off and on again? do you still get the error? The fact that you get this with all your apps is concerning, also it may not help have you tried startign VS in safe mode devenv.exe /SafeMode . this will cancel out 3rd part plugin problems Commented Dec 20, 2017 at 23:55
  • My usual workaround for this issue is Clean Solution, Restart Visual Studio, Clean Solution again. The first clean will often give the same error but the second one usually works for me. Failing that I close the solution and delete all the bin/obj directories manually (or via a batch file if there are a lot of projects). Commented Dec 21, 2017 at 0:11
  • 1
    Have you checked what keeps the file handle? You can use this answer: serverfault.com/a/1980 Commented Dec 21, 2017 at 0:19

1 Answer 1

1

Solved. The problem was an extension called FastFind.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.