MonoMac应用程序中的JSON.NET不允许我构建一个mac app包

时间:2012-05-22 15:17:47

标签: c# .net json mono monomac

我正在尝试构建一个使用JSON.NET库的MonoMac应用程序,但每当我尝试生成应用程序安装程序时,我都会看到以下错误:

Merging Mono into app bundle
    /Applications/Development/MonoDevelop.app/Contents/MacOS/lib/monodevelop/AddIns/MonoDevelop.MonoMac/mmp -o "/tmp/monomac-build-634732855752481110" -n "OfficeDropSync" -a  "/Users/mauricio/projects/mono/winclient/ODWSyncApplication/OfficeDrop.Sync.Business/bin/Release/OfficeDrop.Sync.Business.dll" -a "/Users/mauricio/projects/mono/winclient/ODWSyncApplication/OfficeDrop.Sync.Common/bin/Release/OfficeDrop.Sync.Common.dll" -a "/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.dll" -a "/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.Xml.dll" -a "/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.Core.dll" -a "/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.Xml.Linq.dll" -a "/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/System.Drawing.dll" -a "/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/4.0/Mono.Data.Sqlite.dll" -a "/Users/mauricio/projects/mono/winclient/thirdparty/log4net.dll" -a "/Users/mauricio/projects/mono/winclient/thirdparty/monomac/src/MonoMac.dll" "/Users/mauricio/projects/mono/winclient/ODWSyncApplication/OfficeDrop.Sync.Mac/bin/Release/OfficeDropSync.exe"
Could not link assemblies: Mono.Cecil.ResolutionException: Failed to resolve System.Void Newtonsoft.Json.JsonObjectAttribute::.ctor(Newtonsoft.Json.MemberSerialization)
  at Mono.Linker.Steps.MarkStep.MarkMethod (Mono.Cecil.MethodReference reference) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkCustomAttribute (Mono.Cecil.CustomAttribute ca) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkCustomAttributes (ICustomAttributeProvider provider) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkField (Mono.Cecil.FieldReference reference) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkFields (Mono.Cecil.TypeDefinition type) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.ApplyPreserveInfo (Mono.Cecil.TypeDefinition type) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.InitializeType (Mono.Cecil.TypeDefinition type) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.InitializeAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.Initialize () [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 
  at MonoMac.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 Failed to link /Users/mauricio/projects/mono/winclient/ODWSyncApplication/OfficeDrop.Sync.Mac/bin/Release/OfficeDropSync.exe

mmp exited with code 1

有没有人见过这个?有没有解决这个问题的方法?

1 个答案:

答案 0 :(得分:1)

  

有没有人见过这个?

是。无法解析符号时会发生这种情况。

在您的情况下,您的mmp命令行似乎没有对json程序集的任何直接引用。但是有些程序集引用了它。处理后者以及ResolutionException解析程序无法找到引用的程序集时发生mmp

  

有没有解决这个问题的方法?

手动添加对程序集的引用(确保它将被包含)确保mmp可以找到它(缺少的json库)。