CS0103: The name ‘InitializeComponent’ does not exist in the current context



Feb 8, 2011

When you are trying to build a solution that contains Silverlight or WPF projects using MsBuild you may encounter the error “CS0103: The name ‘InitializeComponent’ does not exist in the current context”. While searching I have found various tactics that involves editing the project files, including namespaces etc.   But the real reason is you are using the wrong version of Msbuild. Multiple versions of Msbuild gets installs in your machine, through various versions of .NET framework, Visual Studio etc. So, check the path variables and make sure you are using the correct version. If you are using Silverlight 4, you need to use MsBuild. Nandri! Saravana