BC30560:名称空间'System.Runtime.CompilerServices'中的'ExtensionAttribute'不明确 [英] BC30560: 'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'

查看:542
本文介绍了BC30560:名称空间'System.Runtime.CompilerServices'中的'ExtensionAttribute'不明确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有asp.net项目(在.net 2.0中),并将项目转换为.net 4.0。
成功构建项目后,我在浏览器上启动了网站,并引发如下错误:

I have asp.net project (in .net 2.0) and I converted project to .net 4.0. After I built the project successfully, I launched the website on browser, it throws error as following:


编译错误

Compilation Error

描述:在为该请求提供服务所需的资源
的编译过程中发生错误。请查看以下特定的
错误详细信息,并适当地修改您的源代码。

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

编译器错误消息:BC30560:在
命名空间 System.Runtime.CompilerServices中, ExtensionAttribute不明确。

Compiler Error Message: BC30560: 'ExtensionAttribute' is ambiguous in the namespace 'System.Runtime.CompilerServices'.

源错误:

[无相关源代码行]

[No relevant source lines]

源文件:InternalXmlHelper。 vb行:9

Source File: InternalXmlHelper.vb Line: 9

........

推荐答案

.NET 2中使用扩展方法(用于LINQ等)的常见技巧。使用C#3(或更高版本)的编译器是在正确的名称空间中定义自己的ExtensionAttribute。

A common trick to use extension methods (for LINQ etc) in .NET 2 with the C# 3 (or above) compiler was to define your own ExtensionAttribute in the right namespace.

现在,您已升级到更高版本的.NET,您需要删除此现在多余的额外属性。查找在代码中定义的位置并删除它。还要检查诸如LINQBridge之类的外部库-您将不再需要它。

Now that you have upgraded to a later version of .NET you need to remove this now-redundant extra attribute. Find where it is defined in your code and expunge it. Also check for external libraries like LINQBridge - you won't need this any more.

找到它的一种方法是使用对象浏览器并搜索ExtensionAttribute。

One way to find it would be to use the object browser and search for ExtensionAttribute.

这篇关于BC30560:名称空间'System.Runtime.CompilerServices'中的'ExtensionAttribute'不明确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆