Access denied to TFSTemp during a TeamBuild TFS Get operation

If you ever see something like the below

Done executing task "Get" -- FAILED.
Done building target "CoreGet" in project "TFSBuild.proj" -- FAILED.
Done Building Project "d:\builds\BuildType\TFSBuild.proj" (EndToEndIteration target(s)) -- FAILED.

Build FAILED.

"d:\builds\BuildType\TFSBuild.proj" (EndToEndIteration target) (1) ->
(CoreGet target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(737,5,737,5): error : d:\builds\Sources\MyBuild\MyProject\MyClass.cs: Access to the path 'C:\Users\BuildUser\AppData\Local\Temp\TFSTemp\2812{#$@;._}3184' is denied.

    0 Warning(s)
1 Error(s)

Then you’ve probably got something like a virus scanner or some other generic application or service that operates on files or areas of the disc (like an indexer, defragger, etc) keeping a lock.  In my case it was a virus scanner. 

I excluded the path and all is now fine.

Took me a good few hours though :(

Technorati Tags: TeamBuild,TFS,Forefront