Search code examples
asp.net-mvcyetanotherforumyaf

YAF.NET integration on MVC website


I wish to integrate YAF.NET (http://yafnet.codeplex.com/) into an existing web site written years ago in MVC 2.0. I wish to have it as a standalone forum, not integrated into my existing pages.

I create a directory and copied all the necessaries files, bin, .config and so on but I get this error:

"Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."

I don't understand why he is trying to load mvc dll .. anyone could help me with this stuff?


Solution

  • Web.config files inherit from their parents, so if your root website is setup for MVC your application web.configs will inherit those settings.

    In this case the root web.config likely added a couple of assembly references which you will need to strip out. The easy way is to add a <clear /> rule to the assembly section (in system.web):

    <compilation>
      <assemblies>
        <clear />
        <!-- add new assembly references here -->
      </assemblies>
    </compilation>
    

    The alternative is to use remove rules which alllow you to remove specific references.

     <compilation>
      <assemblies>
        <remove assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
     </compilation>