我在Mac上的Xamarin Studio中构建PCL时遇到了问题。它在调试模式下工作正常但是fody在发布模式下抛出异常。
构建期间的异常如下所示。
Error: Fody: An unhandled exception occurred:
Exception:
Symbol file `XXX/obj/Release/XXX.dll.mdb' does not match assembly `XXX/obj/Release/XXX.dll'
StackTrace:
at Mono.CompilerServices.SymbolWriter.MonoSymbolFile.CheckGuidMatch (Guid other, System.String filename, System.String assembly) [0x00000] in <filename unknown>:0
at Mono.CompilerServices.SymbolWriter.MonoSymbolFile..ctor (System.String filename, Mono.Cecil.ModuleDefinition module) [0x00000] in <filename unknown>:0
at Mono.CompilerServices.SymbolWriter.MonoSymbolFile.ReadSymbolFile (Mono.Cecil.ModuleDefinition module, System.String filename) [0x00000] in <filename unknown>:0
at Mono.Cecil.Mdb.MdbReaderProvider.GetSymbolReader (Mono.Cecil.ModuleDefinition module, System.String fileName) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleReader.CreateModuleFrom (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0
at InnerWeaver.ReadModule () [0x00000] in <filename unknown>:0
at InnerWeaver.Execute () [0x00000] in <filename unknown>:0
Source:
Mono.Cecil.Mdb
TargetSite:
Void CheckGuidMatch(System.Guid, System.String, System.String)
答案 0 :(得分:15)
Fody需要与输出的组件相关联的调试信息(* .mdb文件)来执行编织步骤。默认情况下,发布版本会关闭构建 - &gt;中的调试信息字段。项目设置中的编译器。
将此构建选项设置为None
会禁用调试符号并导致mdb文件不同步,因此会出现Symbol file 'XXX/obj/Release/XXX.dll.mdb' does not match assembly XXX/obj/Release/XXX.dll
异常。
因此,当您将Fody集成到构建过程中时,需要在发布模式下构建项目时启用仅符号或完整:
答案 1 :(得分:1)
你可能已经,但如果是我,我会从这开始:
在&#34;配置&#34;在左上角下拉,检查&#34; Debug&#34;配置(re:平台|构建|部署)匹配&#34;发布&#34;。