I don't know whether it will help anyone, but I "suddenly" started getting this error and it was compiling perfectly two weeks ago.
I realized that I had compiled the app for a release a fortnight ago and got this error when I wanted to debug it today. After changing the "Active solution configuration" back to "Debug" as it was on "Release", the error went away and I was able to debug it again.