R – Why do the toolbox items disappear in Visual Studio 2008

visual-studio-2008winforms

I'm working on a solution that contains multiple projects targeting Windows Mobile 5 and standard Windows applications.

Lately when opening up a form in designer the common UI controls (textbox, button, label, etc etc…) have vanished leaving only the controls defined within the project.

Resetting the toolbox has no effect. A google search suggested deleting the toolbox temp files in the Local Settings\Application Data\Microsoft\VisualStudio\9.0, however this was only successful in bringing back the default controls for Windows Mobile 5. The WinForms controls are still mysteriously missing.

Also, if I right-click and Select All on the toolbox, all of the WinForms controls do in fact come up, however they're all grayed out.

Has anyone else experienced this?

Best Answer

I just had a similiar problem. In a managed C++ project all the default toolbox items disappeared form the winforms designer. After playing around for a while I found that there was a problem in the .vcproj file.

<VisualStudioProject
    ProjectType="Visual C++"
    Version="9,00"
    Name="COLLADA Import"
    ProjectGUID="{0DEEF9B6-1929-44E3-92EC-13712839FB63}"
    RootNamespace="COLLADAImport"
    Keyword="ManagedCProj"
    TargetFrameworkVersion="0"
    >

When you set TargetFrameworkVersion to a valid number, for example 131072 for .Net 2.0, the toolbox items will be back.