简体   繁体   中英

The item X was specified more than once in the “Sources” parameter

I have a Xamarin.Forms project and I drag and drop an image to my Android resources folder, then I copied it and pasted it in my UWP Project, but the image doesnt display, so I changed its build action to Content, but it displays the error:

Error The item "obj\\Debug\\MainPage.xaml.g.cs" was specified more than once in the "Sources" parameter. Duplicate items are not supported by the "Sources" parameter. XamaTask.Android
Im not sure if its related with the images, but after I duplicated,renamed and changed that build action property the error started to show , I also deleted the images and renamed more times again and checked my Android.csproject but I dont find any duplicated item.
Edit
I have found the file that have the error, but Again, I dont find any duplicated, here it is the code:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: global::Xamarin.Forms.Xaml.XamlResourceIdAttribute("XamaTask.Droid.MainPage.xaml", "MainPage.xaml", typeof(global::XamaTask.MainPage))]

namespace XamaTask {


    [global::Xamarin.Forms.Xaml.XamlFilePathAttribute("C:\\Users\\M\\source\\repos\\XamaTask\\XamaTask\\XamaTask\\MainPage.xaml")]
    public partial class MainPage : global::Xamarin.Forms.ContentPage {

        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "2.0.0.0")]
        private void InitializeComponent() {
            global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(MainPage));
        }
    }
}

I ran into this after a bad merge. I edited the .csproj and removed the duplicate line that included the same .cs file twice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM