Fody:发生未处理的异常

6
我在构建项目时突然出现了异常。似乎与Mono.Cecil有关,但我的项目中没有使用Mono。

错误 13 Fody:发生未处理的异常:异常:找不到文件或程序集“Mono.Cecil,Version = 0.9.6.0,Culture = neutral,PublicKeyToken = 0738eb9f132ed756”或其依赖项。程序集的发现清单定义与程序集引用不匹配。(HRESULT 异常:0x80131040)StackTrace:在 System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType) 在 System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters() 在 System.Reflection.RuntimeMethodInfo.GetParametersNoCopy() 在 System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
在 System.Reflection.RuntimePropertyInfo.GetIndexParameters() 在 System.RuntimeType.GetPropertyCandidates(String name, BindingFlags bindingAttr, Type[] types, Boolean allowPrefixLookup) 在 System.RuntimeType.GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) 在 System.Type.GetProperty(String name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) 在 PropertyDelegateBuilder.BuildPropertySetDelegate[T](Type type, String propertyName) in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\DelegateBuilders\PropertyDelegateBuilder.cs:Zeile 9. 在 DelegateBuilder.BuildDelegateHolder(Type weaverType) in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\DelegateBuilders\DelegateBuilder.cs:Zeile 25. 在 DelegateBuilder.GetDelegateHolderFromCache(Type weaverType) in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\DelegateBuilders\DelegateBuilder.cs:Zeile 16. 在 InnerWeaver.InitialiseWeavers(List`1 weaverInstances) in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\InnerWeaver.cs:Zeile 65. 在 InnerWeaver.Execute() in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\InnerWeaver.cs:Zeile 30. Source: mscorlib TargetSite: Void GetSignature(Void*, Int32, System.RuntimeFieldHandleInternal, System.IRuntimeMethodInfo, System.RuntimeType)

有什么想法吗?我已经尝试重新安装Costura.Fody包。
7个回答

3

我通过执行以下命令,将版本从1.3.4降级到1.3.3来解决了这个问题:

在Package-Manager-Console中执行以下命令:

Install-Package Costura.Fody -Version 1.3.3.0

这样就可以解决问题了。


2

尝试更新你的项目中的Costura.Fody包。对我来说,这已经足够了。


是的,我们通过将所有项目中的软件包更新到通用版本来解决了这个问题。我想主要问题是由于项目中Fody版本不匹配引起的。 - sarbis

1

我这里也遇到了完全相同的问题。

上周还好好的,我们什么都没改,但现在Costura.Fody似乎要寻找Mono.Cecil 0.9.6.0,但我只能在packages文件夹中找到0.9.5.0...

我尝试将Costura.Fody降级至1.3.3.0,Fody降级至1.26.1,但仍然遇到完全相同的问题。

你可以在这里看到其他人也遇到了这个问题: https://github.com/Fody/Costura/issues/118


你有找到任何与Costura.Fody相媲美的替代品吗? - Thomas Hahn
很遗憾,@ThomasHahn,目前还没有,但是Costura在今天发布的1.3.5版本中已经修复了。 - KavenG

0
通过删除项目的obj文件夹来解决了这个问题。

0

0

我去了nuget文件夹,例如C:/../.nuget\packages\cauldron.interception.fody\3.2.3\netclassicweaver\Cauldron.Interception.Fody.dll

删除了这个cauldron.interception.fody文件夹。

然后现在它开始从cauldron.basicinterceptors中获取值,然后构建成功了。


0

Costura.Fody 1.4.1 解决了这个问题

Install-Package Costura.Fody -Version 1.4.1

感谢 @distantcam 的贡献


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接