Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Xamarin生成时出现未知错误_C#_Xamarin - Fatal编程技术网

C# Xamarin生成时出现未知错误

C# Xamarin生成时出现未知错误,c#,xamarin,C#,Xamarin,我有个问题。当我尝试编译我的xamarin应用程序时,出现以下4个错误: 1.)重复“全局::Xamarin.Forms.Xaml.XamlFilePathAttribute”属性MyApp C:\Users\alex\source\repos\MyApp\MyApp\obj\Debug\netstandard2.0\RegisterPage.xaml.g.cs 2.)类型“MainPage”已使用相同的参数类型定义了名为“InitializeComponent”的成员 3.“FilterAss

我有个问题。当我尝试编译我的xamarin应用程序时,出现以下4个错误:

1.)重复“全局::Xamarin.Forms.Xaml.XamlFilePathAttribute”属性MyApp C:\Users\alex\source\repos\MyApp\MyApp\obj\Debug\netstandard2.0\RegisterPage.xaml.g.cs

2.)类型“MainPage”已使用相同的参数类型定义了名为“InitializeComponent”的成员

3.“FilterAssembly”任务意外失败。 System.IO.FileNotFoundException:找不到文件“C:\Users\alex\source\repos\MyApp\MyApp\MyApp\bin\Debug\netstandard2.0\MyApp.dll”。 文件名:“C:\Users\alex\source\repos\MyApp\MyApp\MyApp\bin\Debug\netstandard2.0\MyApp.dll” 在System.IO.\uuu Error.WinIOError(Int32 errorCode,字符串maybeFullPath) 在System.IO.FileStream.Init(字符串路径、文件模式、文件访问权限、Int32权限、布尔用户权限、文件共享、Int32缓冲大小、文件选项选项、安全属性secAttrs、字符串msgPath、布尔bFromProxy、布尔useLongPath、布尔checkHost) 位于System.IO.FileStream..ctor(字符串路径、文件模式、文件访问访问、文件共享) 在Xamarin.Android.Tasks.filterasemblies.Execute()中 位于Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ItaskeExecutionHost.Execute() 在Microsoft.Build.BackEnd.TaskBuilder.d_u26.MoveNext()MyApp.Android上

4.)找不到元数据文件“C:\Users\alex\source\repos\MyApp\MyApp\MyApp\bin\Debug\netstandard2.0\MyApp.dll”MyApp.iOS C:\Users\alex\source\repos\MyApp\MyApp\MyApp.iOS\CSC

我刚刚开始使用这个应用程序,所以到目前为止我还没做多少工作。我唯一做的事情就是用axml创建了2个内容页

这是我的RegisterPage.axml:

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace MyApp
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class RegisterPage : ContentPage
    {
        public RegisterPage()
        {
            lblSignInAddRecognizer();
        }

        void lblSignInAddRecognizer()
        {
            lblSignIn.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() =>
                {
                    DisplayAlert("Task", "Clicked it!", "OK");
                })
            });
        }
    }
}
这是我的主页:

using Xamarin.Forms;

namespace MyApp
{
    [DesignTimeVisible(false)]
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
        }
    }
}

有什么办法可以解决这个问题吗?

要将此标记为答案。在XAML文件更新中

         <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:d="http://xamarin.com/schemas/2014/forms/design"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         mc:Ignorable="d"
         x:Class="SOLTUION_NAME.PAGE_NAME">

到解决方案\u名称到您的解决方案名称 并将页面名称更改为xaml的名称


这对我很有帮助。

似乎您在主页中重写了方法
InitializeComponent()
。您可以提供
MainPage
RegisterPage
的代码和xaml。代码现在有问题。我已经从代码中删除了InitializeComponent(),但仍然是相同的错误!删除文件夹bin和obj,然后清理并重建你的项目。我已经解决了。这是axml中的复制/粘贴错误。我有一个x:类,两个页面都一样。你可以发布答案并接受它,这将帮助更多的人。