Good article and had basically come to a lot of the same conclusions mention here.
I had another similar issue which i though was worth sharing as it took a couple of days to sort out. As part of a move to 64 bit we installed VS 2012 alongside VS 2010 for a peek but decided to stay with VS 2010. I therefore uninstalled VS2012 and this is where my problems began. When i opened forms in VS 2010 (especially inherited forms) they would usually render in the designer fine. However, any subsequent close and reopen would cause a load of errors in the designer referring to “The variable ‘X’ is either undeclared or was never assigned”. Interesting enough was the ‘X’ usually related to properties of Infragistics controls that are used on our base form..
The issue turned out to be .net 4.5 that was installed as part of VS2012 but was not removed as part of the uninstall. I assumed VS2010 was still using it (as i could not see .net 4 under installed programs) so I decided to uninstall .net 4.5. At this stage (after uninstall) if you try to start VS2010 you will get “unexpected error” at the visual studio splash screen. Next step was to repair VS2010 which in turn installed .net 4. Once VS2010 was restarted the issues with the designer disappeared.
You’ll have to dig out any references to the wrong version number. First, do as Marc says: get rid of all compiled assemblies that Visual Studio may be using. Also make sure that VS can’t find the wrong version in the GAC because it might be grabbing that one as well. Restarting VS is also a good idea as it sometimes retains caches references in memory.
If none of that works, then you have an explicit reference to the assembly using the old version number somewhere in your solution. Check project files for references with that version number; check those pesky
license.licx files (you can just delete the offending line from those).
Good luck! And be reassured, there’s always some logical reason for the assembly mismatch. It’s just sometimes tedious to find.
First I would try deleting ALL compiled binaries in all bin and obj directories (for all your projects). Then do a rebuild and maybe restart VS.
We created Windows batchfiles to do this when VS bot in trouble again.
I am having the problem described above where the underlying component is version 18.104.22.168, but the designer is trying to load 22.214.171.124. Any ideas on how to force VS to load the current version? I used to be able to simply rebuild the underlying assembly and the problem would be solved, but since I moved to 64bit, this strategy no longer seems to work.
I am just listening to a phonecall my colleague has with a customer. Seems the customer did not read this blog yet.