Method not found: System.Web.Mvc.MvcHtmlString Combres.Mvc.MvcExtensions.CombresLink

Aug 10, 2012 at 2:41 PM

I'm using MVC 3 with Razor, I've followed the instructions in the quick start but I'm getting the error:

Method not found: 'System.Web.Mvc.MvcHtmlString Combres.Mvc.MvcExtensions.CombresLink(System.Web.Mvc.HtmlHelper, System.String)'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: 'System.Web.Mvc.MvcHtmlString Combres.Mvc.MvcExtensions.CombresLink(System.Web.Mvc.HtmlHelper, System.String)'.

Source Error:

Line 28:         <div id="bd">
Line 29:             <div class="columns clearfix">
Line 30:                 @RenderBody()
Line 31:             </div>
Line 32:         </div>

I'm not sure why the error is thrown here, the @Html.Combreslink is called much earlier. I'm pretty sure the necessary Combres components are wired up as we have another project that works fine. Any help appreciated!

 

Aug 11, 2012 at 11:51 PM

Make sure you include @using Combres.Mvc whenever @Url.CombresLink is used. Or import that namespace to all razor pages, see http://stackoverflow.com/a/3876409/17815

Aug 13, 2012 at 11:28 AM

@buunguyen - thanks for the response. Everything in my project related to Combres is exactly like another solution we have, where Combres works great. 

In the end I created a new ASP.Net (Framework 4) MVC 3 Razor project and added Combres to ensure that my assembly versions were correct. It turned out that I have System.Web.Mvc 2.0.0.0 in my GAC and this was being picked up even though I had an explicit reference to 3.0.0.0 in web.config. The following redirect ensures that v3 is used:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>