1

While working on an ASP.NET MVC application, I meet the good old "The current source code is different from the version built into App_Web_blahblah.dll" when I'm trying to debug a CSHTML file, whatever I do (deleting Temporary ASP.NET files, PDBs, cleaning and rebuilding, etc).

What's more disturbing is that the related CSHTML page isn't compiled anymore. I mean, the application keeps showing an old version of the page, even if this one has changed.

There's no errors on this page (the same source code works OK on another machine). Even if there were, I would get a YSOD and that's it.

More importantly, it keeps displaying data that isn't in the source code anymore, and even if I cleaned the temporary files and DLLs everywhere before, so I can't work on this page anymore.

I checked there and there, but none of the answers solved the problem.

So my question is simple : where can the application find code that isn't anywhere (AFAIK) ? Is there another location that I'm not aware of where compiled files can be stored ? What's happening ?

Community
  • 1
  • 1
xlecoustillier
  • 16,183
  • 14
  • 60
  • 85
  • Are changes in others cshtmls are reflected? Have you tried to remove everything from that cshtml and try to compile? – Vladimirs Nov 24 '14 at 14:05
  • @Vladimirs Yes, other CSHTML are still updated correctly when I make changes. And yes, I tried displaying an empty page, but it still displays the same old one. – xlecoustillier Nov 24 '14 at 14:09
  • Presumably you've manually deleted the contents of the bin and obj folders? – Carl Nov 24 '14 at 14:13
  • @Carl I did, along with everything else. – xlecoustillier Nov 24 '14 at 14:14
  • 1
    I think I had this kind of problem. Delete your whole file and then add it again. There is possibility that your file isn't located in correct folder. – Paweł Reszka Nov 24 '14 at 14:20
  • @PawełReszka My god, you're right... The file had somehow been copied to another location, meaning I was modifying the wrong one. I can't believe that it was so simple. Should have started with that. Thanks a lot! – xlecoustillier Nov 24 '14 at 14:31

1 Answers1

1

My comment helped so I will write an answer.

This error was caused adding to project file from another destination. You were modifying file which wasn't in correct folder, but old one was still there. Application was running the old one, because it isn't looking at csproj file, but only at files there are placed exactly in Views folder.

Paweł Reszka
  • 1,557
  • 4
  • 20
  • 41