QUICK FIX:
I believe the issue is that Visual Studio is natively 32bit and one cannot do GUI editing for some components (E.g. ListView) in 64bit.
E.g. on forms where you have ListView, you need to change the solution to 32bit to edit the GUI.
So the answer in short is, when you’re facing this issue:
- Change the solution to 32bit or AnyCPU
- Clean and rebuild the solution/project
- Open the GUI for editing
- Save, change the solution back to 64bit
- Clean and rebuild
- Run in 64bit
Unfortunately Visual Studio doesn’t come in 64bit as yet, hence all controls need to be designed in 32bit mode (or AnyCPU mode).
See this question for reference.
VS 2010 designer error ‘Could not find type XYZ’ in Windows7. Works fine in XP
UPDATED FIX:
I finally found a proper fix for the problem to load and edit my custom/32bit controls in a 64bit environment using the VS GUI design editor. Note that this works up to Visual Studio 2019, the architecture of the designed editor has changed in VS 2022 so I’m not sure if this will still work there.
Essentially there are a couple of things happening with the Visual Studio Design editor which prevent you from editing custom/32bit controls in a 64bit design environment.
- You’ll notice that your custom/32bit control doesn’t show up in the designer
Toolbox
when you load any form while in a 64bit target environment. This is part of the root cause of the issue; because your control doesn’t show up in thetoolbox
, when VS tries to load a form which is using that control (or a class which extends that control), it throws the error, Could not find type ‘xxx.xxx.xxx’ (in the toolbox, that’s the part it doesn’t specify) - One of the reasons that the controls don’t show up in the toolbox is because Visual Studio does NOT load custom controls from the current project into the toolbox (either automatically or even if you manually try to force it). So if your custom 32bit control is in the current project, the toolbox won’t register it and consequently the editor will be unable to load the form. See reference
The solution here is to create a new project within the same solution and move your custom/32bit controls into a new namespace within that new project. Now Visual Studio will be able to see and load your controls into the Toolbox
. This should happen automatically, optionally you can add the attribute [ToolboxBitmapAttribute(true)]
to your public class definition on your custom control. Once your custom control shows up in the Toolbox then the Visual Studio design editor should have no problems finding the assembly and loading your form and allowing you to edit your custom 32bit control in the 64bit design environment.