87

I have a C# console app in Visual Studio 2010 that I can run just fine. When I attempt to run the process in debug mode, I am presented with the following error:

clr.dll version doesn't match mscordacwks.dll

I have tried searching for any information, but I haven't been able to find anything. Can anyone provide clues as to why I can't run this with the debugger?

EDIT: I should clarify that I have been able to successfully debug a console app previously, this is a new situation.

Rebecca Chernoff
  • 22,065
  • 5
  • 42
  • 46

11 Answers11

175

From what I can tell when I'm able to reproduce this error, it is caused by being in the middle of installing Windows updates. So, running updates, then postponing a reboot, then attempting to debug code is what was putting me in this broken state.

Rebecca Chernoff
  • 22,065
  • 5
  • 42
  • 46
  • 1
    +1 - I had the same error, but when trying to attach to a process. My computer had failed installing some updates, and was pending a reboot. After rebooting and retrying the updates, I can attach again. – Paul Jul 11 '11 at 18:21
  • 4
    My computer is in the process of running updates, which could be related. Though in my case simply closing and reopening VS 2010 fixed the problem. – TTT Aug 18 '11 at 18:09
  • 1
    On VS 2012 SP 1, after a .net framework update, I had this error. Restarting only IIS Express for application (the one from VS) also solved the issue without having to reboot the computer. – Sebastien F. Feb 08 '13 at 12:20
  • 4
    Sometimes I really hate Microsoft. –  Jun 04 '13 at 19:51
  • 2
    I also got this error when using Windows update, but could run my solution just fine after restarting Visual Studio (2010). I didn't need to restart the computer or complete the updating procedure beforehand either. – Sheridan Jul 11 '13 at 08:37
  • Just had the same issue with VS2010 on an XP machine. Any idea if this happens with win 8? Frustrating. – Hooloovoo Jul 30 '13 at 10:34
  • TTT is correct. Restarting VS worked for me while in the middle of a Windows Update postpone. – Brent Lamborn Feb 14 '14 at 16:20
  • sigh... thanks it could have been nearly impossible to figure that out – Dave Cousineau Aug 18 '17 at 23:13
6

I had this issue once and it was caused by an pending Windows Update on the Server where the process was running, which I wanted to attach.

Chris
  • 61
  • 1
  • 1
4

I encountered the same issue. It happened to me when I attempted to attach to a process for debugging purposes. At the time I had postponed a pending windows update.

Everything started working fine after I restarted my computer and allowed the update to take place.

Additional notes: I had recently updated to Visual Studio 2010 Ultimate and installed its Service Pack 1.

Jeremy Ray Brown
  • 1,499
  • 19
  • 23
4

I had this when I installed .NET 4.6 for Visual Studio 2013.

In this particular case, restarting Visual Studio 2013 solved the problem.

Contango
  • 76,540
  • 58
  • 260
  • 305
3

I have finally solved this!

It seemed to have happened after I updated my Windows 7. One of my files must have been out of date.

The fix: Install VS 2010 Service Pack 1

Worked correctly right after I installed. Hitting breakpoints and everything!

Hope this works for you too!

Reno
  • 33,594
  • 11
  • 89
  • 102
sharpper
  • 3,005
  • 2
  • 16
  • 16
3

I also updated to Service Pack 1, and made sure Windows updates were up to date, but I was still having the same issue:

"The Version of CLR.dll in the target does not match the one mscordacwks.dll was built for."

Microsoft closed this issue on connect.microsoft.com as not reproducible... Unforgivable, irresponsible support system!!

But on social.msdn.com I was directed to upgrade through this link, and this has resolved the problem in my machine ( Win7,VS2010,target 4.0)

Hope it helps.

AakashM
  • 62,551
  • 17
  • 151
  • 186
HydPhani
  • 592
  • 6
  • 13
2

Simply. Restarting Visual Studio solved the problem in my case.

Manish Dubey
  • 706
  • 4
  • 17
1

I had VS 2010 SP1 for ages and had rebooted many times. There wasn't any windows update in progress either. I closed all my VS 2010 IDEs and then opened them, and the problem was gone.

Farhan
  • 2,535
  • 4
  • 32
  • 54
1

This happens, when you do a WINDOWS UPDATE and haven't rebooted your system and the update isn't compatible with VISUAL STUDIO. So in order to solve this, just do an update on VISUAL STUDIO to latest. That should FIX it

ManJan
  • 3,939
  • 3
  • 20
  • 22
1

I had this weird issue after installing .net framework 4.5, when using .net 4 for my project. updating VS 2010 service pack didn't solve this, only removal of .net 4.5 and 4, and then reinstalling .net 4 only.

IdoT
  • 2,831
  • 1
  • 24
  • 35
1

I have VS2013 on Win7 and restarting VS worked for me. Seems it is a VS/CLR bug.

Nir Maoz
  • 53
  • 1
  • 5