Using VB.NET with MVC3 and Razor.
I have a test page for a custom extension to htmlhelper. Visual Studio tells me the view is not ok :
code of index.vbhtml (view)
<h2>@ViewData("Message")</h2>
@Html.CustomLink("text 321312", 123)
Error : CustomLink is not a member of System.Web.Mvc.HtmlHelper(..)
code of LinkExtension.vb (extension)
Imports System.Runtime.CompilerServices
Imports System.Web.Mvc
Public Module htmlHelperExtensions
<Extension()> _
Public Function CustomLink(htmlHelper As HtmlHelper, linkText As String, uuid As Short) As MvcHtmlString
Return MvcHtmlString.Create(String.Format("<a href="#{1}">{0}</a>", linkText, uuid )
End Function
End Module
web.config (added namespace)
I added a reference to my librairy in both general web.config and view web.config
(I also tried to add it to the controller.)
<system.web>
<pages>
<namespaces>
[...]
<add namespace="linkExtension" />
</namespaces>
</pages>
</system.web>
The page run correctly and build the html as I need it. But VS keeps telling me the code is not right (CustomLink is not a member of 'System.Web.HtmlHelper(Of Object)')! Any ideas?