Could not load file or assembly System.Web.WebPages.Deployment

后端 未结 7 1713
[愿得一人]
[愿得一人] 2020-12-18 23:53

Im working developing a system web page and suddenly appears this error:

Could not load file or assembly \'System.Web.WebPages.Deployment, Version=1.0.0.0, C         


        
相关标签:
7条回答
  • 2020-12-19 00:01

    In my case this was due to corrupted assembly being referenced which happened due to crash restart of my laptop.

    To fix this please following these steps

    1. Clean all the files in the following folders of your project or you can simply click on clean project and clean solution

      • \bin
      • \obj
    2. Clean the Appdata temp folder for my Win 7 machine its located here C:\Users\your_username\AppData\Local\Temp\Temporary ASP.NET Files in windows 7

    Hope this helps!

    0 讨论(0)
  • 2020-12-19 00:03

    Please try the following steps.

    1. Check the Version of System.Web.Webpages in your References. Say Your Version is=X.X.X.X

    2.In Webconfig

    a.Add the assembly first

    <assemblies>        
        <add assembly="System.Web.WebPages, Version=X.X.X.X, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    

    b.Bind the assembly for runtime

    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-X.X.X.X" newVersion="X.X.X.X"/>
      </dependentAssembly>        
    </assemblyBinding>
    

    3.Make sure you have added correct key

    <appSettings>
        <add key="webpages:Version" value="X.X.X.X"/>
    </appSettings>
    

    This worked for me. Hope It'll help you too.

    0 讨论(0)
  • 2020-12-19 00:09

    I wrote a long post about this on my personal blog to document the problem for my future use, but I will just put the solution here for anyone else to use:

    You need to install WebMatrix

    Long story short the required DLLs are missing from the GAC MSIL and they need to be installed. You can install both versions of WebMatrix 1.0.0.0 and 2.0.0.0 as they can coexist just fine; or just install the one you need:

    +--------------------------+---------------------------------------------------------------------+-------------+
    |      Installer name      |                                 URL                                 | DLL Version |
    +--------------------------+---------------------------------------------------------------------+-------------+
    | AspNetWebPages.msi       | https://www.microsoft.com/en-us/download/confirmation.aspx?id=15979 |     1.0.0.0 |
    | AspNetWebPages2Setup.exe | https://www.microsoft.com/en-us/download/details.aspx?id=34600      |     2.0.0.0 |
    +--------------------------+---------------------------------------------------------------------+-------------+
    

    Clickable links

    • https://www.microsoft.com/en-us/download/confirmation.aspx?id=15979
    • https://www.microsoft.com/en-us/download/details.aspx?id=34600
    0 讨论(0)
  • 2020-12-19 00:13

    I resolved this problem adding line below in web.config of project...

    Before I marked in MANAGE NUGET "Microsoft.AspNet.Mvc/5.1.2", "Microsoft ASP.NET Web Pages/3.1.2", I try anything but nothing works (really!! uninstall VS and read a lot articles)

    <dependentAssembly>
       <assemblyIdentity name="System.Web.WebPages.Deployment" publicKeyToken="31bf3856ad364e35" />
       <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
    </dependentAssembly>
    

    Good lucky

    0 讨论(0)
  • 2020-12-19 00:15

    What I usually do is go to the machine where you compile you code and go to dos prompt and type this

    C:> dir System.Web.WebPages.Depl* /s 
    

    There might be several of them usually in

    c:/windows/Microsoft.Net/assembly/GAG_MSIL/System.web.WebPage/v....../
    

    check the date and make sure is the same as System.Web.WebPages.dll copy it to the bin where your target machine is. This should fix the problem.

    0 讨论(0)
  • 2020-12-19 00:18

    Try copy paste or package install of System.Web.WebPages.dll in your web bin directory.

    You can grab it from NuGet Gallery,

    https://www.nuget.org/packages/Microsoft.AspNet.WebPages/

    See to that the version matches.

    0 讨论(0)
提交回复
热议问题