我有一个相对简单的Xamarin.Forms应用程序,该应用程序使用Realm.io进行持久化。我可以在发布和调试配置中构建应用程序。但是,当我尝试将应用程序存档以进行分发时,创建包失败,并显示以下错误:
System.ArgumentException: An item with the same key has already been added. Key: ProcessedByFody
at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x0015a] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <b814b509d4ad406fb40c6c93e38929e7>:0
at System.Linq.Enumerable.ToDictionary[TSource,TKey] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x0007d] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:71
at System.Linq.Enumerable.ToDictionary[TSource,TKey] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:34
at MonoDroid.Tuner.MarkJavaObjects.GetTypesInModule (Mono.Cecil.ModuleDefinition module) [0x00006] in <fa231dc8d40d45fd86217b6055f9a563>:0
at MonoDroid.Tuner.MarkJavaObjects.FindType (Mono.Cecil.TypeDefinition type, System.String fullname) [0x0001b] in <fa231dc8d40d45fd86217b6055f9a563>:0
at MonoDroid.Tuner.MarkJavaObjects.GetHelperType (Mono.Cecil.TypeDefinition type, System.String suffix) [0x00042] in <fa231dc8d40d45fd86217b6055f9a563>:0
at MonoDroid.Tuner.MarkJavaObjects.PreserveHelperType (Mono.Cecil.TypeDefinition type, System.String suffix) [0x00000] in <fa231dc8d40d45fd86217b6055f9a563>:0
at MonoDroid.Tuner.MarkJavaObjects.PreserveAdapter (Mono.Cecil.TypeDefinition type) [0x00000] in <fa231dc8d40d45fd86217b6055f9a563>:0
at MonoDroid.Tuner.MarkJavaObjects.PreserveJavaObjectImplementation (Mono.Cecil.TypeDefinition type) [0x0000e] in <fa231dc8d40d45fd86217b6055f9a563>:0
at MonoDroid.Tuner.MarkJavaObjects.ProcessType (Mono.Cecil.TypeDefinition type) [0x00009] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Mono.Tuner.SubStepDispatcher.DispatchType (Mono.Cecil.TypeDefinition type) [0x0002d] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Mono.Tuner.SubStepDispatcher.BrowseTypes (System.Collections.ICollection types) [0x00018] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x0003f] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000e] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Mono.Linker.Pipeline.ProcessStep (Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) [0x0000d] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x0000f] in <fa231dc8d40d45fd86217b6055f9a563>:0
at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <fa231dc8d40d45fd86217b6055f9a563>:0
at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x00071] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x002d4] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Xamarin.Android.Tasks.LinkAssemblies.Execute () [0x0001b] in <fa231dc8d40d45fd86217b6055f9a563>:0
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:574
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:805
Done building target "_LinkAssembliesShrink" in project "MyProject.Android.csproj" -- FAILED.
我正在使用Visual Studio for Mac Enterprise版本8.3.1(内部版本18)
我的应用程序正在使用以下Nuget软件包:
在将Realm添加到项目之前,我能够将应用程序存档。以前是否有人遇到过(希望)解决了Realm / Fody / Xamarin的类似问题?
注意:我能够通过将Realm降级到3.4.0来解决此问题。
答案 0 :(得分:0)
您可以尝试以下方法:
1。方法1
转到VS菜单Tools
> Options
> Xamarin
> Archives Location
如果路径不以\
结尾,则归档失败。只需在末尾添加\
。
2。方法2
1)。转到项目文件夹并删除bin
和obj
文件夹
2)。转到项目属性并增加版本号并更改版本名称
3)。现在点击存档