使用模板的新Xamarin.Forms解决方案失败

时间:2018-07-09 09:30:27

标签: xamarin xamarin.forms

我通过选择:文件>新建解决方案>使用.Net标准库的Forms App创建了一个新的Xamarin.Forms解决方案。

我在不进行任何代码更改的情况下立即重建,会看到以下错误:

namespace test3.Droid
{
    [Activity(Label = "test3", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
    }
}
  

受保护的重写无效OnCreate(捆绑包)

Green line under bundle with this message: parameter name differs in base declaration
  

TabLayoutResource = Resource.Layout.Tabbar;   ToolbarResource = Resource.Layout.Toolbar;

Red line under Tabbar with this message: Ambiguity between Resource.Layout.Tabbar and Resource.Layout.Tabbar

有人知道发生了什么吗?希望获得一些建议。

请注意,如果有任何帮助,似乎有两个版本的Resource:

..test3.Android/Resources/Resource.designer.cs
..test3.Android/obj/debug/designtime/Resoure.designer.cs

至于覆盖是否不同,我不确定是什么导致了该问题

谢谢

1 个答案:

答案 0 :(得分:2)

  

参数名称在基本声明中有所不同

项目模板只是在参数名称上不匹配,它不会引起任何编译/运行时问题,只是在编辑器中很难看到。您可以将名称更改为savedInstanceState匹配,以使Intellisense满意。

  

Resource.Layout.Tabbar和Resource.Lay .....之间的歧义

含糊不清的问题是将生成的文件应用于基于Roslyn的Intellisense系统的错误。长期存在的已知问题已得到修复,并在不同发行版中多次被打破。看到红色的Intellisense行是一件很痛苦的事情,但是该项目可以编译/正常运行...

相关问题