" XamlCTask"任务意外失败"使用新的Xamarin Forms构建时出错

时间:2017-04-06 11:32:26

标签: xamarin xamarin.forms

在我更新到最新的Xamarin.Forms(2.3.4.224)后,我不断遇到构建错误。谁知道这可能是什么?

我怀疑它可能与他们在关于附加属性的新版本中引入的新行为更改有关(但我不知道这意味着什么)

此处有更多信息https://forums.xamarin.com/discussion/92455/xamarin-forms-2-3-4-224

这是我的构建日志

Error       The "XamlCTask" task failed unexpectedly.
System.ArgumentException: An item with the same key has already been added.

Server stack trace: 
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode node, XmlReader reader)
   at Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader reader, Boolean nested)
   at Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode node, XmlReader reader)
   at Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader reader, Boolean nested)
   at Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode node, XmlReader reader)
   at Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader reader, Boolean nested)
   at Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode node, XmlReader reader)
   at Xamarin.Forms.Xaml.XamlParser.ParseXaml(RootNode rootNode, XmlReader reader)
   at Xamarin.Forms.Build.Tasks.XamlTask.ParseXaml(Stream stream, TypeReference typeReference)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute(IList`1& thrownExceptions)
   at Xamarin.Forms.Build.Tasks.XamlTask.Execute()
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Build.Framework.ITask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() Shared          

2 个答案:

答案 0 :(得分:0)

我不确定这是否是相同的情况,但我遇到了同样的问题。

我安装了不同版本的Forms。在我更新了所有nuget包并删除了所有obj和bin文件夹后,我能够进行构建而没有错误。

答案 1 :(得分:0)

清理解决方案并关闭Visual Studio 2017.当您再次打开它时,错误将消失。