I have a Visual Studio 2013 solution that is under source control (TFS, Visual Studio Online). It is mapped to a local workspace, I have checked out some files (e.g. web.config, global.asax). 

When I try to save any changes to files I get a 'Save File As' dialog, and if I hit Save it warns me the file already exists (say, web.config), and asks me if I want to replace it. If I hit Yes I get I get an error dialog saying 'the process cannot access the file '....\wyfvmjia.p1p~' because it is used by another process. I have no idea what this file is or how it is related to the file (web.config) I am trying to save. 

This is infuriating, any help would be greatly appreciated!

EDIT 1:

It looks like the Visual Studio process (devenv.exe) is creating and deleting random temporary files in the same folder (e.g. wyfvmjia.p1p~) and is causing a 'sharing violation' on those files (I used a sys internals utility to monitor the folder) when I am trying to save let's say web.config.

EDIT 2:

[This](https://github.com/codereflection/Giles/issues/40) seems to suggest in one of the comments that VS2013 creates a copy of a file and then replaces the original when trying to save a file in your project. This would explain why I see temporary files getting created and deleted. It's odd I get the 'Save File As' dialog though. It looks like some other process (antivirus?) gets hold of the temporary file before VS can do something with it? 

EDIT 3:

I created a console application project with only a program.cs file and the same is happening. This may be a problem with Antivirus software interfering with the VS2013 'copy-replace' feature.

EDIT 4:

Changed title. Still have not been able to find a solution.

EDIT 5:

See the accepted answer. Apologies for not getting back earlier.