Xamarin - Type or name of application namespace not found

This error is currently trying to launch the Xamarin app for my iPhone in real time.

"AppDelegate.cs(1,1): error: The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)" 

My solution builds without errors, so it’s a bit stuck. These errors did not occur until I updated to the last update. Any help is appreciated.

App.xaml.cs:

 using System; using System.Collections.Generic; using System.Linq; using System.Text; using COCApp; using Xamarin.Forms; namespace COCApp { public partial class App : Application { public App() { InitializeComponent(); MainPage = new NavigationPage(new MainPage()); } protected override void OnStart() { // Handle when your app starts } protected override void OnSleep() { // Handle when your app sleeps } protected override void OnResume() { // Handle when your app resumes } } } 

Appdelegate.cs

 using System; using System.Collections.Generic; using System.Linq; using COCApp; using Foundation; using UIKit; namespace COCApp.iOS { // The UIApplicationDelegate for the application. This class is responsible for launching the // User Interface of the application, as well as listening (and optionally responding) to // application events from iOS. [Register("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); LoadApplication(new App()); return base.FinishedLaunching(app, options); } } } 
+5
source share
2 answers

I had a similar problem for Android and iOS, but mine would work fine and fine if there weren’t a red underline in the app for both projects.

I installed it by right-clicking on the "Links for Android" β†’ "Add Link" - "Projects" link, and then uncheck the already included shared project by clicking "OK". Then I re-added the general project and fixed the error.

Note that PCL no longer works when starting the Xamarin.Forms project in the latest version of Visual Studio, now its .Net standard.

+5
source

Check your project to make sure it has a link to the PCL.

enter image description here

+2
source

Source: https://habr.com/ru/post/1274159/


All Articles