Google Resolved: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?) (Error: CS0246) | SubramanyamRaju Xamarin & Windows App Dev Tutorials

Wednesday 6 March 2019

Resolved: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?) (Error: CS0246)

Introduction:
There is common error in xamarin.forms project when you trying to build solution for android or iOS.

"Error: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?) (CS0246)"
Description:
In general, you will get above error in two files:
1. Android project: MainActivity class at code line (LoadApplication(new App());. 

2. iOS project: AppDelegate class at code line LoadApplication(new App());
Solution:
If you got error like "A type or namespace that is used in the program was not found". You might have forgotten/missed to reference the assembly that contains the type, or you might not have added the required using directive. Or, there might be an issue with the assembly you are trying to reference.
For Example,
In above description, we are referring to "new App()" class object which is comes from PCL project. So we have to check valid reference of PCL project in both platform specific projects (i.e android & iOS), delete invalid-reference and put them back in to resolve the error.
You can also see overview of this article from below youtube video. Also for more videos please don't forget to SUBSCRIBE our youtube channel from here.


FeedBack Note: Please share your thoughts, what you think about this post, Is this post really helpful for you? I always welcome if you drop comments on this post and it would be impressive.
Follow me always at @Subramanyam_B
Have a nice day by  :)

1 comment:

  1. Hi,

    I am trying to build Xamarin.ios project in visual studio for Mac 2019.I am getting "The type or namespace name 'Android' could not be found" error when I build the project.

    When I debug the issue it points to the following line. using Android.OS; in one of the xaml.cs file.

    ReplyDelete

Search Engine Submission - AddMe