Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the source file is different from when the module was built

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?
like image 232
frustratedcoder Avatar asked Jun 21 '10 18:06

frustratedcoder


People also ask

What is source file in Visual Studio?

Visual Studio. File formats category - v • e edit. Visual Basic source files are files that contain Visual Basic source code. There is no distinction between source files created by VB 6.0 and below and by Visual Basic 2003 and higher.

What is source file in C#?

A source file consists of an optional set of option statements, import statements, and attributes, which are followed by a namespace body. The attributes, which must each have either the Assembly or Module modifier, apply to the .NET assembly or module produced by the compilation.


1 Answers

I got this issue running a console app where the source that was different was the source that had the entry-point (static void Main). Deleting the bin and obj directories and doing a full rebuild seemed to correct this, but every time I made a code change, it would go out-of-date again.

The reason I found for this was:

  1. I had checked "Only build startup projects and dependencies on Run" (Tools -> Options -> Projects and Solutions -> Build and Run)
  2. In Configuration Manager, my start-up project didn't have "Build" checked

(For #2 -> accessible via the toolbar under the 'Debug/Release' drop down list.)

like image 73
Eliott Avatar answered Sep 19 '22 12:09

Eliott