2

I had to make some changes to the ASP.NET MVC System.Web.Webpages dll. But when I replace the dll it throws me this error.

The type 'System.Web.WebPages.WebPageBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

Jasonw
  • 5,054
  • 7
  • 43
  • 48
user460025
  • 629
  • 1
  • 10
  • 20

3 Answers3

4

I had the same problem,

I eventually solved it by following the advice here.

And adding the following to my web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- … -->
  <system.web>
    <!-- … -->
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
      </assemblies>
    </compilation>
    <!-- … -->
  </system.web>
  <!-- … -->
</configuration>
Community
  • 1
  • 1
shenku
  • 11,969
  • 12
  • 64
  • 118
2

I found that the "copy Local" to true for the referenced "System.Web.Webpages" DLL helped in my case. I also had to do the same to some of the other DLLs as well.

Dib
  • 2,001
  • 2
  • 29
  • 45
1

I got this error too when I was moving around directories within TFS. I fixed this error by opening NuGet and updating the MVC framework that was refererenced in all the DLLs.

4444
  • 3,541
  • 10
  • 32
  • 43
Josh
  • 79
  • 1
  • 8