(Microsoft .NET,Microsoft ASP.NET,Microsoft Team Foundation Server,MSBuild)
by Jason Skowronek
Over the past day or so, I have been dealing with a quite elusive and frustratingly evil build problem in one of many web projects in our Team Foundation System build environment. Apparently, though we have a rule to excluded the "obj" folder from our commits, someone on the team "somehow" committed the "obj" folder. This apparently causes havoc when MSBuild attempts to write to various source files that are set read-only. Consequently, when the build process runs, you "may" see the following error in your build summary/log file:
C:\Windows\Microsoft.NET\Framework\v#\Microsoft.Common.targets (#): Could not write lines to file "obj\%CONFIGURATION%)\%PROJECTNAME%.csproj.FileListAbsolute.txt". Access to the path '%MSBUILD_SOURCE_PATH%\obj\%CONFIGURATION%)\%PROJECTNAME%.csproj.FileListAbsolute.txt' is denied.
The solution is simple, delete the "obj" folder from source control, commit the changes, and re-run the build.