XAML Tips: Why do I get error – Error The name ‘InitializeComponent’ does not exist in the current context

I am going to list few most annoying Errors XAML designer throws to me and hope you find right solution.

Most likely by this time you have already gone though your error list many times and scratching your head.. why you getting nonsense errors? If that’s what you facing then first go though few checks.

1) Make sure all dependencies are compiled properly without error.

2) If you recently copy/paste any files or added files as link make sure you select proper build Action. I got this error when copied linked files from one project to another. So be very careful after copy/paste links from one project to another it will most likely change Build action (Looks like VS2012 bug ??? )
– Here is list of most common Build Actions
– For *.cs, *.vb ==> Set BuildAction=Compile
– For *.xaml ==> Set BuildAction=Page
– For Sample data file ==> Set BuildAction=DesignData or Page
– For Images ==> Set BuildAction=Content or Resource
– For any embedded font files ==> Set BuildAction=BlendEmbeddedFont , and check Project Code for

3) Make sure you go though all errors in the list and find out any actual errors other than listed below found in the list which might be causing error.

4) Make sure no file referenced in project with warning icon. This means you referencing something which got deleted. Check same for reference.
Here is list of most common errors which can be resolved by above steps.

Error : The name “blah-blah” does not exist in the namespace “clr-namespace:MyApp;assembly=MyApp”

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

Error : The name “LocalizedStrings” does not exist in the namespace “clr-namespace:MyApp;assembly=MyApp”

Vote this if it helps!!!

Binary World is a Software Development company located in Atlanta, USA (since 2007). Binary World specialized in Business Intelligence, mobile, cloud computing and .Net Application Development.

Tagged with: ,
Posted in SilverLight, Tips, Visual Studio, Windows Phone, WPF, XAML

Leave a Reply