本文介绍了RC的WebAPI“System.Runtime.CompilerServices.ExtensionAttribute”从程序集“mscorlib程序,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行.NET4,我试图让工作在服务器上的应用程序的WebAPI。该API本地工作正常。

What do I need to change to get this to work on my server?

解决方案

Are you sure you were compiling against .NET 4 and not .NET 4.5? We moved ExtensionAttribute to mscorlib in .NET 4.5 (so we could put extension methods in mscorlib). I'd expect to see an error like that if you compiled something against .NET 4.5 and tried to run it on .NET 4.

EDIT: Actually, if you are using ILMerge, you need to use the path to the .NET 4.0 reference assemblies in the targetplatform switch, instead of the path to the implementation, as described in this blog post: http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx

这篇关于RC的WebAPI“System.Runtime.CompilerServices.ExtensionAttribute”从程序集“mscorlib程序,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 23:44