In my situation it was related to Web Site/Web Application type of the project. We recently moved to MVC and had to change it to Web Application.
So, the solution was simple: select your web-site in Solution Explorer and remove it from the solution, then right click on the solution and select Add -> Existing Project (not Web Site), recompile the web-site.