C# 已定义initializeComponent和_contentLoaded之间的歧义
我在VS2012的c#项目中遇到了一个关于initializeComponent()的错误 类型已定义名为initializecomponent的成员 我决定尝试排除项目的这一部分,这样它就可以工作了。项目的其余部分都很好。当我再次添加项目的该部分时,没有发生InitializeComponent错误,但我得到了一个关于以下内容的错误: _contentLoad和_contentLoad之间的歧义 这是关于deleteCustomerPerform的,但是VS显示deleteCustomerPerform.g.i.cs中的内容(g.i.是什么意思?)。这是代码的一部分:C# 已定义initializeComponent和_contentLoaded之间的歧义,c#,wpf,visual-studio-2012,compiler-errors,C#,Wpf,Visual Studio 2012,Compiler Errors,我在VS2012的c#项目中遇到了一个关于initializeComponent()的错误 类型已定义名为initializecomponent的成员 我决定尝试排除项目的这一部分,这样它就可以工作了。项目的其余部分都很好。当我再次添加项目的该部分时,没有发生InitializeComponent错误,但我得到了一个关于以下内容的错误: _contentLoad和_contentLoad之间的歧义 这是关于deleteCustomerPerform的,但是VS显示deleteCustomerPe
namespace PropertyManagementPoland.CustomerForms {
/// <summary>
/// MainCustomerForm
/// </summary>
public partial class MainCustomerForm : System.Windows.Window, System.Windows.Markup.IComponentConnector {
private bool _contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/PropertyManagementPoland;component/customerforms/deletecustomerform.xaml", System.UriKind.Relative);
#line 1 "..\..\..\CustomerForms\DeleteCustomerForm.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
this._contentLoaded = true;
}
}
名称空间PropertyManagementPoland.CustomPerforms{
///
///主要客户执行
///
公共部分类MainCustomPerform:System.Windows.Window、System.Windows.Markup.IComponentConnector{
私有bool_内容加载;
///
///初始化组件
///
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute(“PresentationBuildTasks”,“4.0.0.0”)]
public void InitializeComponent(){
如果(_contentLoaded){
返回;
}
_contentLoaded=true;
System.uriresourcelocater=new System.Uri(“/PropertyManagementPoland;component/customerforms/deletecustomerform.xaml”,System.UriKind.Relative);
#第1行“.\..\..\CustomPerforms\DeleteCustomPerform.xaml”
System.Windows.Application.LoadComponent(这是resourceLocater);
#行默认值
#隐藏线
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute(“PresentationBuildTasks”,“4.0.0.0”)]
[System.ComponentModel.EditorBrowsBalAttribute(System.ComponentModel.EditorBrowsBalState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(“Microsoft.Design”,“CA1033:InterfaceMethodsShouldbycallableByChildTypes”)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(“Microsoft.维修性”、“CA1502:AvoidExcessiveComplexity”)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(“Microsoft.Performance”、“CA1800:DonotCast不必要”)]
void System.Windows.Markup.IComponentConnector.Connect(int-connectionId,对象目标){
这是。_contentLoaded=true;
}
}
}
我需要尽快完成我的项目,但我不知道如何解决这个问题。
当做
巴托斯。我找到了解决办法!当我复制XAML时,我忘了更改其中一个表单上的x:Class名称。
谢谢你的时间,克里斯。祝您度过愉快的一天。清洁溶液中的所有垃圾箱文件夹并重新构建溶液。如果不起作用,请发布maincustomexper.cs