I want to change my C# project, which is based on the .NET 4.0 to 3.5. So I changed the project\'s target-framework to 3.5.
After re-opening and trying to compile the pr
I had this error when I installed a COM component in NET 4.5 then downgraded to NET 4.0. Removing and adding the reference made no difference.
I found this helpful.
* Solution or Workaround Change the default Platform Target CPU to allow applications to run on 64-bit machines. *
http://forums.arcgis.com/threads/19335-COM-Exception-was-unhandled-and-Class-not-registered
The NET 4.0 target environment for me is 32bit, so I get the Target CPU down to x86 in the properties window. Now it runs.
That reference is pointing to .Net 4 - you need to remove all .net 4 references and then readd them using the .net 3.5 version of the assemly and then it will work
paul
Changing the Target framework setting is not exactly perfect. In a C# project for example you have to remove the reference to Microsoft.CSharp by hand. And yes, it doesn't automatically update the System.Drawing assembly references in the .resx files. This is quite a flaw, works okay when you increase the .NET version number (what just about everybody normally does), kaboom if you try to decrease it. .NET is only forward compatible.
You'll have to remove the resources and add them back after changing the target framework. Pretty painful, editing the .resx file by hand to minimize the job is however possible. Right-click the .resx file, Open With and select the text editor. Change the Version for the assembly name from 4.0.0.0 to 2.0.0.0.
Beware however that there can be trickier resources, like ImageList, the kind whose data got embedded in the .resx in binary. You'll see a blob of base64 encoded bytes in the .resx file. That also has the version number embedded, done so by BinaryFormatter. The possible reason that VS doesn't do this for you. Writing a little program that decodes that base64 string back to byte[], locates the proper 0x34 and changes it to 0x32 and converts it back to base64 is only a hacker's delight, man over machine style :) Best to just re-add those to avoid the almost inevitable oopses.