{"id":560,"date":"2022-05-20T16:39:21","date_gmt":"2022-05-20T15:39:21","guid":{"rendered":"https:\/\/ibex.tech\/csharp\/?p=560"},"modified":"2022-05-20T17:04:37","modified_gmt":"2022-05-20T16:04:37","slug":"xaml-cs-does-not-exist-in-current-context-error","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/c-sharp\/issues\/xaml-cs-does-not-exist-in-current-context-error","title":{"rendered":"xaml.cs Does Not Exist in Current Context Error"},"content":{"rendered":"\n<p>Seems to be a VS bug whereby in some instances adding or renaming an object in the xaml file causes &#8220;Does Not Exist in Current Context Error&#8221; when using the object in the .xaml.cs file.  Looking online it seems to be something that plagues lots of devs&#8230;<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Compiles OK but Intellisense red lining the object name in .xaml.cs file &#8211; Fix<\/h4>\n\n\n\n<p>Ensure you are in Debug mode &#8211; have found that changing from Release to debug mode, cleaning and then rebuilding can cure the issue.  If not, stay in debug mode, then:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Clean your project<\/li><li>Manually delete bin and obj folders (in all folders if your project has more than one project type)<\/li><li>Restart VS<\/li><li>Rebuild your project (you may need to do for all project types if you have more than one project type)<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Won&#8217;t compile &#8211; Possible fix<\/h4>\n\n\n\n<p>Add ;assembly= at the end of your xmlns:local, like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  xmlns:local=\"using:my_namespace_name;assembly=\"<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Seems to be a VS bug whereby in some instances adding or renaming an object in the xaml file causes &#8220;Does Not Exist in Current Context Error&#8221; when using the object in the .xaml.cs file. Looking online it seems to be something that plagues lots of devs&#8230; Compiles OK but Intellisense red lining the object [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[],"class_list":["post-560","post","type-post","status-publish","format-standard","hentry","category-issues"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=560"}],"version-history":[{"count":6,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/560\/revisions"}],"predecessor-version":[{"id":568,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/560\/revisions\/568"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}