The problem is the files were under source control so when they were copied to the build folder they were all copied with the same read-only attribute. The build failed as it couldn't write to the read-only file.

A useful enhancement to the build process would be to remove the readonly attribute on files copied to the build folder.