the source file is different from when the module

2019-01-08 07:17发布

This is driving me crazy.

I have a rather large project that I am trying to modify. I noticed earlier that when I typed DbCommand, visual studio did not do any syntax highlighting on it, and I am using using System.Data.Common.

Even though nothing was highlighted, the project seemed to be running fine in my browser. So I decided to run the debugger to see if things were really working as they should be.

Every time the class that didn't do the highlighting is called I get the "the source file is different from when the module was built" message.

I cleaned the solution and rebuilt it several times, deleted tmp files, followed all the directions here Getting "The source file is different from when the module was built.", restarted the web server and still it tells me the source files are different when they clearly are not.

I cannot test any of the code I have written today because of this.

  • How can the source be different than the binary when I just complied it?
  • Is there any way to knock some sense into visual studio, or am I just missing something?

26条回答
祖国的老花朵
2楼-- · 2019-01-08 07:51

solution:- the problem is:- if your some projects in a solution , refer to some other projects, then sometimes the dll of some projects, will not update automatically, whenever you build the solution, some projects will have previous build dlls, not latest dlls

you have to go manually and copy the dll of latest build project into referenced project

查看更多
Evening l夕情丶
3楼-- · 2019-01-08 07:51

In my case, the @Eliott's answer doesn't work. To solve this problem I had Exclude/Include From Project my deficient file, andalso Clean and Rebuild the solution.

After these actions, my file with my last modifications and the debugger are restored.

I hope this help.

查看更多
家丑人穷心不美
4楼-- · 2019-01-08 07:54

Follow these steps

  1. Just delete the bin directory from the project where the DLL is generated.
  2. Re-build the project.
  3. Remove reference from the project that make reference to the DLL.
  4. Include again the reference.
  5. Enjoy.
查看更多
forever°为你锁心
5楼-- · 2019-01-08 07:54

Unload the project that has the file that is causing the error.

Reload the project.

Fixed

查看更多
Anthone
6楼-- · 2019-01-08 07:55

Some things for you to check:

Have you double checked your project references?

Do you have a Visual Studio started web server still running? Check the system tray and look for a page with a cog icon (you may have more than one):

alt text http://blogs.msdn.com/blogfiles/webdevtools/WindowsLiveWriter/Tip.NetDevelopmentServerinaMultiprojectS_104C2/image_2.png

Right click and close/exit it. You may have more than one. Can you debug your changes now?

Are you running the debug version but have only built the release version (or vice versa)?

Did the compile actually succeed? I know I've clicked through the "there were errors, do you want to continue anyway?" message a couple of times without realising.

查看更多
看我几分像从前
7楼-- · 2019-01-08 07:55

At Visual Studio 2015, using C++, what fixed for me the the source file is different from when the module was built problem was

  • restart Visual Studio.
查看更多
登录 后发表回答