问题描述
我正在开始一个工作项目,我在尝试创建WPF应用程序时遇到此错误,它显示在MainWindow.XAML
I'm beginning a project for work and I've come across this error when trying to create a WPF application, it shows on MainWindow.XAML
System.ArgumentException具有相同的项目密钥已添加。 System.ChrowHelper.ThrowArgumentException(ExceptionResource资源)在System.Collections.Generic.Dictionary 2.Insert(TKey
2.Add(TKey key,TValue value)at Microsoft.VisualStudio.DesignTools.Utility.Telemetry.VsTelemetryService。 Microsoft.VisualStudio.DesignTools.Utility.DesignerSessionTracker.RecordDesignerStart(Int32 processID,String isol)上的Microsoft.VisualStudio.DesignTools.Utility.Feedback.WatsonTracker.RegisterSession(Int32 processID)中的RegisterDesignerProcessSession(Int32
key,TValue value,Boolean add)at System.Collections.Generic.Dictionary
pid) Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory,IIsolationBoundary boundary,AppDomainSetup appDomainInfo,IIsolationTarget
isolationTarget,String baseDirectory)中的ationTargetIdentifier,Boolean mockCustomTypes,
String buildConfiguration )在Microsoft.VisualStudio.DesignTools的Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.Initialize()
中的Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)。 Microsoft.VisualStudio.DesignTools.DesignerHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget $ b)中的Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedObjectFactory.Initialize()的DesignerContract.Isolation.Primitives.IsolationBoundary.CreateInstance [T](Type type) $ b isolationTarget,IObjectCatalog cata log)在Microsoft.VisualStudio.DesignTools.DesignerContract的Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget
isolationTarget)上的Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)。 .IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget,CancellationToken cancelToken,DesignerServiceEntry&在Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.InvokeWithCulture [T]的Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken
cancelToken)中输入,IServiceProvider serviceOverrides)(CultureInfo culture,Func 2
1.b__0()
func,CancellationToken cancelToken)在Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler。<> c__DisplayClass10_0
asks.Task.Execute()
如何解决这个问题?
推荐答案
欢迎来到MSDN论坛。
Welcome to the MSDN forum.
看起来你遇到了当您尝试创建新的WPF项目时出现异常,请参阅错误消息"已添加了具有相同密钥的项目",请尝试使用以下内容来解决此问题:
It looks like you meet the exception when you tried to create a new WPF project, refer to the error message "An item with the same key has already been added", please have a try with the following to troubleshot this issue:
- 请检查 VS2010
WPF设计器例外;"已添加具有相同密钥的项目"
并且您可以尝试创建本地帐户并使用它登录,然后检查是否可以获得与DV9相同的提醒消息,检查您的C:\并重命名C:\ program(最好重命名或备份它) ,如果我们需要回滚)。 - 编辑.csproj文件并检查是否有任何重复的资源
- 转到工具 - 导入和导出设置>全部重置设置>保存当前设置,然后重置为默认设置
- 转到控制面板 - 程序和功能,然后右键单击VS 2015,更改修复以修复VS 2015
祝你好运,
Sara
这篇关于Visual Studio 2015 WPF模板创建问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!