Is this just one project? If you create a new project what happens? Did you convert this project from VS1010? There are major changes in VS2012 which can easily break old projects, depending on how they were built. Broken projects can behave very strangely.
I can’t give you an exact reason why, other than the above. The solution is to create a brand new project and just copy the source code files across.
If the problem exists on a new test project, or reoccurs on a new project you create then it’s a gremlin hunt. Or as Sir Fred Hoyle famously wrote in “The Black Cloud”: “Because bastard inside, maybe”.
And get yourself on source control (Subversion is the easiest).
1
solved Why is Visual Studio erasing my files [closed]