I have a extension method "PageUrl" that is overriding the PageUrl method in EPiServer.Web.Mvc.Html.UrlExtensions
public static IHtmlString PageUrl(this UrlHelper urlHelper, string classicUrl)
When I remove my extension method then I get an exception that my method is not found. But if I remove the usage of it on the views where it is used, compile the code and then reenter the usage of it and compile then no exception is triggered. This method works locally but not if I want to deploy the code to the live site...
Is there a way to let the "system" know that it should use PageUrl that is in EPiServer.Web.Mvc.Html.UrlExtensions instead of my removed method?
I have also tried to move the extension method to another class but then I get this message when hovering over the PageUrl method in the views where it is used:
"The call is ambiguous between the following methods or properties: 'EPiServer.Web.Mvc.Html.UrlExtensions.PageUrl(System.Web.Mvc.UrlHelper, string)' and MyEPiApplication.Helpers.UrlHelpers.PageUrl(System.Web.Mvc.UrlHelper, string)'".
How to let the system know?1) Add a `@using` statement to the top of your view file
2) Add the namespace containing the extension method to the web.config file inside the view folder
Thanks for your answer!
I solved it by: