CSC error CS0016: Access is denied

CSC error CS0016: Could not write to output file 'd:\BuildAgent\work\6498d93ace9e01ff\.....\obj\Release\XYZ.dll' -- 'Access is denied. '

I get the above error once in a while. I use msbuild to builds the projects through TeamCity.

3 comments
Comment actions Permalink

The file is probably locked by some parallel process.
Does it happen when you start MSBuild outside of TeamCity?

0
Comment actions Permalink

I ran it on my local machine with the max cpu count as 3. Now it ran fine. But occassionally it fails when using TeamCity Build agent. It has not been failing from couple days again.

0
Comment actions Permalink

I would suggest to take Process Monitor and watch what processes access this file

0

Please sign in to leave a comment.