c# - 在“来源”参数中多次指定了 X 项
问题描述
我有一个 Xamarin.Forms 项目,我将图像拖放到我的 Android 资源文件夹中,然后将其复制并粘贴到我的 UWP 项目中,但图像不显示,因此我将其构建操作更改为内容,但它显示错误:
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
我不确定它是否与图像有关,但是在我复制、重命名和更改该构建操作属性后,错误开始显示,我还删除了图像并再次重命名并检查了我的 Android.csproject 但我没有发现任何重复物品。
编辑
我找到了有错误的文件,但同样,我没有找到任何重复的,这里是代码:
//------------------------------------------------------------------------------
// <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));
}
}
}
解决方案
我在一次糟糕的合并后遇到了这个问题。我编辑了 .csproj 并删除了两次包含相同 .cs 文件的重复行。
推荐阅读
- node.js - 使用外部库时电子应用程序崩溃而没有任何错误消息
- firebase - 如何解决错误:在 Android Studio 中找不到符号导入 androidx.appcompat.widget.RecyclerView
- angular - NgbDatepicker:在弹出窗口中使用日期选择器时如何提供 ContentTemplate?
- telegram - Telegram bot api:GIF 上传/下载大小的问题
- java - 如何使用 Event ChangeListener() 从 JSpinner 读取时间并在控制台上打印?
- c++ - 枚举类的编译时索引器
- android - 无法从 RxJava2 准确迁移到 RxJava3
- android - Android:(Camera2)相机从活动返回后不再存在异常
- python - 如何将行数设置在 QTableView 的右侧?
- terminal - 现在强制 ncurses 更改光标颜色