这是我的扩展方法:
Public Module HtmlExtensions
System.Runtime.CompilerServices.Extension
Public Function ReverseMapPath(ByVal html As HtmlHelper, ByVal path As String) As String
Dim appPath = HttpContext.Current.Server.MapPath("~")
Dim res As String = String.Format("{0}", path.Replace(appPath, "/").Replace("\", "/"))
Return res
End Function
End Module
我的 web.config 有我的命名空间的条目
一切正常。我开始向项目添加更多代码,现在我收到一个错误,看起来好像我正在加载扩展方法两次,但我不知道为什么。错误是:
path.page.vbhtml(9): error BC30521: Overload resolution failed because no accessible 'FunctionName' is most specific for these arguments:
Extension method 'Public Function FunctionName(path As String) As String' defined in 'namespace.Extensions.HtmlExtensions': Not most specific.
Extension method 'Public Function FunctionName((path As String) As String' defined in 'namespace.Extensions.HtmlExtensions': Not most specific.
我不明白为什么这只是悄悄地出现了。显然我改变了一些东西,但撤销一切并没有帮助。该错误似乎更多地落后于 .net 框架。有任何想法吗?