7

I'm trying to debug an ASP.Net web project that I received. I modified a class in the "Apps_LocalResources" folder.

When I debug and the code tries to step into that class, I get

"The source file is different from when the module was built.".

I rebuilt the solution and didn't get any change. I even published it to a different location and the pdb and dll in the bin folder didn't change so I didn't copy them over.

Ideas?

Chris
  • 8,527
  • 10
  • 34
  • 51

7 Answers7

5

Just delete Obj file from application root and rebuild

Sibiraj
  • 51
  • 1
  • 1
4

If you are attaching to asp.net worker process, then kill the process, start up the website and reattach the debugger.

If you are using the built in web server, then make sure you stop the project and the WebDev.WebServer.Exe associated with it.

If all else fails, right click on the breakpoint and choose locations. Then enable the "allow code to be different..." check box at the bottom.

StingyJack
  • 19,041
  • 10
  • 63
  • 122
1

Delete the folder root under (4ex): C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root

And then in VS2005: Tools->Options->Debugging-> General and uncheck Require source file to exactly match the original version

This was the solution for me.

RodoUY
  • 29
  • 5
  • 2
    By doing so, you only get rid of the warning, not the fact that your debugger will skip added lines, as the code file just doesn't match the assembly to debug. – M463 Jun 19 '15 at 10:05
0

Click the refresh button at the Solution Explorer. That solved the issue for me.

Edit 7/8/2013: Also check that you don't have multiple versions of the same dll between your project. If you do, keep the latest one in the project solution and the rest in a folder outside your project scope. I do recommend that you have a Libraries folder to put all your dlls, so you don't have dlls in multiple folders.

mtzaldo
  • 105
  • 4
0

For My case, I depending project file using try catch. It throw the exception so the file can not update. When avoid the exception it works fine.

Singaravelan
  • 809
  • 3
  • 19
  • 32
0

Saying you're referencing a .dll, that is build by a side-project you're modifying along with your main project.

If your Reference is set to the .dll-file, that is being built by the Release-Configuration (referred path to the .dll is something like bin\Release\YOURDLL.dll), check if you're really building the side project using the Release-configuration in the configuration manager.

configuration manager

Also, assure that your project Dependencies and Build Order are set correctly, so the side-project that your main project is depending on, will be freshly build before your main project is getting build.

Project dependencies and Build Order

M463
  • 2,003
  • 3
  • 23
  • 39
0

Restarting Visual Studio worked for me.

abkk
  • 1