UnauthorizedAccessException: Access to the path is denied

I was importing the new Facebook SDK to Unity 5 and I got the following error after Unity upgraded the scripts.

UnauthorizedAccessException: Access to the path “Library\UnityAssemblies\UnityEngine.UI.xml” is denied.
System.IO.File.Delete (System.String path) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/File.cs:179)
SyntaxTree.VisualStudio.Unity.Bridge.Project.SafeDelete (System.String file)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.CleanDeployPath ()
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.DeployUnityAssemblies (SyntaxTree.VisualStudio.Unity.Bridge.ProjectSystem.UnitySolution solution)
SyntaxTree.VisualStudio.Unity.Bridge.ProjectFilesGenerator.GenerateProject ()
SyntaxTree.VisualStudio.Unity.Bridge.Project+<>c__DisplayClass3.b__2 ()
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/artifacts/generated/common/editor/EditorApplication.gen.cs:268)

I’m using Unity 5.0.0f4 and FacebookSDK-150128. What could be wrong here?

I can’t confirm it was the issue, but I had this and after closing and re-opening Visual Studio the error stopped coming up.

For me it was McAfee. I had to turn off real-time scanning.