我正在创建一个使用PostSharp
2.1 进行 AOP 的 .net 4.0 应用程序。
现在Microsoft.Bcl.Async稳定了,我想async
在这个应用程序中使用。
但是,这样做时,我遇到了以下PostSharp
问题:
PostSharp.Sdk.CodeModel.AssemblyLoadException: Cannot find assembly 'mscorlib, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e'. [Public key mismatch]
============ PostSharp Assembly Loading Log ===================
LOG: Finding the assembly with binding identity 'mscorlib, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e'.
LOG: Probing location 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' because this file was explicitly added to the search path.
LOG: File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' has identity 'mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil'.
LOG: File 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' does not match the reference.
这只发生在要编译的程序集引用System.ServiceModel
并包含以下代码时:
new FaultContractAttribute(typeof(SomeType));
我猜这与 上的[__DynamicallyInvokable]
属性有关System.ServiceModel.FaultContractAttribute
ctor
,它说:
"Performance critical to inline this type of method across NGen image boundaries".
有没有人遇到过同样的问题?