none
The name 'InitializeComponent' does not exist in the current context

    Question

  • I have a similar problem as previously reported (but not solved in my case) :

    "If I create a new project in Visual Studio 2010 SP1 and select "WPF Application" it generates the application, but I get the error "The name 'InitializeComponent' does not exist in the current context" even before i build it. I get the same error when I try to build established projects. Yesterday (30th July 2012), I had no problems with it. "

    Im pretty sure that this issue is nothing to do with the project, source files or generated settings, but may have to do with a corrupt visual studio installation, registry, .net or windows itself because the same project (exactly the same) builds fine on my coleagues computer and vice-versa does not. Also, i have reinstalled Visual Studio, uninstalled & reinstalled, deleted & reinstalled, install-fixed from the microsoft disks and even tried manually deleting Visual studio/.net/C# and still get the problem. This issue is with both new WPF projects created with the wizard and with existing projects created weeks earlier.

    I did manage to get it sorted briefly by going back to a restore point of the 31st July, but my Intel Fortran compiler stopped working then so reversed the restore to investigate further and now the previous restore points are no longer available. I also vaguely remember seeing an 'hotfix' Visual Studio update in my update list at about the same time, but i can now find no record of this so no way of confirming it.

    I have also tried :- Instaling the c# Express edition and got the same error. Doing a full virus scan - no problems. Full scandisk/checkdisk - no problem.

    The only option that seems to present itself now seems to be wiping my hard drive and reinstalling windows and Visual Studio again etc.

    Any ideas regarding the fault or how best to wipe my system down to a level that will truly eradicate Visual Studio and its registry setting would be gratefully received ?

    Tuesday, August 07, 2012 9:11 AM

Answers

  • Thanks for trying but i have now resorted to restoring my PC from scratch, including windows 7, registry etc, its the only thing that seems to solve it in my case.

    However, to answere your points - Its did only occur on a WPF project, all other templates and languages were fine and although it does require an InitializeComponent method it should have been auto generated by VS/XAML in a .g file.

    The lower versions on my PC and even a fresh installatiojn of the express edition also failed with the same problem.

    Thanks.

    Thursday, August 09, 2012 12:28 PM

All replies

  • I haven't used Visual Studio 2010 but does the problem only occur on a WPF Application project?

    Why not try a Windows Application project. If it doesn't show an InitializeComponent method, maybe it way designed that way because you may need to design the interface through code yourself.

    Also try installing a lower version of visual studio 2008 and see if the problem persist.


    Always remember to say "Thanks" and do necessary actions to show your appreciation. Thanks!

    Thursday, August 09, 2012 12:37 AM
  • Thanks for trying but i have now resorted to restoring my PC from scratch, including windows 7, registry etc, its the only thing that seems to solve it in my case.

    However, to answere your points - Its did only occur on a WPF project, all other templates and languages were fine and although it does require an InitializeComponent method it should have been auto generated by VS/XAML in a .g file.

    The lower versions on my PC and even a fresh installatiojn of the express edition also failed with the same problem.

    Thanks.

    Thursday, August 09, 2012 12:28 PM
  • Sad to hear that you resorted to that option. Anyway thanks for sharing.

    Always remember to say "Thanks" and do necessary actions to show your appreciation. Thanks!

    Friday, August 10, 2012 3:56 AM