Error building Player because scripts had compiler errors

Every time I try to compile I get this error:


Unhandled Exception: System.UnauthorizedAccessException: Access to the path “C:\Users\MyUserName\Documents\UnityProjects\MyProjectName\Temp\Assembly-CSharp-firstpass.dll.mdb” is denied.


then under that it says:


Error building Player because scripts had compiler errors
then I tried opening a new project, but it does it to all projects plz help
thx in advance!

Do as virgiliu suggested and try to take ownership of that file. Other suggestion: Close Unity, delete posible Temp folder in "C:\Users\MyUserName\Documents\UnityProjects\MyProjectName". It’s safe to delete it when Unity is closed. Then open Unity again and try to compile.

If neither of our suggestions doesn’t work for you then you can try to represent this problem with empty project and send bug report to Unity.