0

我正在创建一个使用PostSharp2.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".

有没有人遇到过同样的问题?

4

1 回答 1

1

PostSharp 尚不支持 Microsoft.BCL(在撰写本文时,我们的版本为 v3.0.38)。您可以在这里为该功能投票:https ://postsharp.uservoice.com/forums/4949-general/suggestions/4225929-support-for-microsoft-bcl

于 2013-10-21T13:30:54.853 回答