Error – the source file is different from when the module was built

This error in the title was very frustrating because it was stopping me test my code.

I had a console app to test the plugin code.  I was building the plugin in a separate project and referencing the dell in my console app.

I would then step through the code but when it got to the point of stepping through the plugin code I was getting the error

the source file is different from when the module was built


I understood what is was saying, which is basically the DLL and PDB file were not the same in my console app as the latest file.

This forum has a few answers (they didn’t help)



So my understanding of the error was my console app wasn’t using the latest dll, pdb file but why.  If you are wondering what the pdb file is, it’s basically the dll file in a code which a debugger can use.

this explanation is a bit better

A pdb file contains information for the debugger to work with. There’s less information in a Release build than in a Debug build anyway, but if you want it to not be generated at all, go to your project’s Build properties, select the Release configuration, click on “Advanced…” and under “Debug Info” pick “None


So I looked in the build folder and then I noticed the dll hadn’t been updated since this morning.  I rebuilt the project but it the dll wasn’t updating.

A bit more poking about and I found the DLL was going to a completely different folder.   So I changed the reference in my console app and pow, it worked.

Why was I looking in the wrong folder

When any project but Plugin project gets build you specify a build output path.  You can check this by right clicking on a project and clicking properties

Usually this is


output path

but for some reason (I’m pretty sure this was me) the output path had changed to \…\…\…\…\…\BuildDLLs

So the reason why my console app had stopped picking up the correct DLL because the DLL had moved from the directory





I changed the output directory to bin\Debug and then it all started to work again.

How this had changed was quite beyond me

One thought on “Error – the source file is different from when the module was built

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s