c# – Xamarin – 无法找到类型或命名空间名称“App”
发布时间:2020-12-15 08:33:33 所属栏目:百科 来源:网络整理
导读:目前正在尝试将我的Xamarin应用程序运行到我的iPhone实时播放器时出现此错误. "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?)" 我的解决方案构建没有错
目前正在尝试将我的Xamarin应用程序运行到我的iPhone实时播放器时出现此错误.
"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?)" 我的解决方案构建没有错误,因此有点卡住. 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); } } } 解决方法
我在Android和iOS上遇到了类似的问题,但是我的构建和运行都很好,除了两个项目下的App下都有红色下划线.
我通过右键单击Android References-> Add Reference-> Projects修复了它,然后单击OK取消选中已包含的共享项目. 请注意,在最新的Visual Studio版本中启动Xamarin.Forms项目时,PCL已不再是它的.Net标准. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
- Choose Minimal or Maximal Repetition (选择最小
- c# – 使用LINQ更新IEnumerable对象的简单方法
- c# – ConvertBack方法什么时候被调用?
- 如何在Phonegap 3上使用plugin.xml复制自定义ios
- ruby-on-rails – 如何解决您的供应商/缓存目录中
- vb.net – 计算多维数组中的项目
- c# – 使用Mono.Cecil替换对类型/命名空间的引用
- How to Use Ext Ajax in Promise Style and Test
- iphone构建错误,让我想买一把钉枪
- ios – 如何将Xcode项目重用到新项目中?静态库,
热点阅读