Window Update Broke MVC Application

后端 未结 3 1677
时光取名叫无心
时光取名叫无心 2021-01-12 01:01

I ran Windows Update yesterday and its introduced some problems when I\'m trying to release a new version of my ASP.NET MVC 4 project.

The application compiles and r

相关标签:
3条回答
  • 2021-01-12 01:37

    After digging down some more, I found the web.config inside the view folder is pointing to different version System.web.mvc . Once I changed to

    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
    

    from

    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    

    change version of System.Web.MVC to 4.0.0.0 from 4.0.0.1 I was able to solve the issue.

    0 讨论(0)
  • 2021-01-12 01:42

    The error message is telling me that you have specified an incorrect version number for the MVC assembly in one of your config files. Find it the config file with the incorrect version and change it to match whatever version you are using (you mentioned 4.0.0.1 above). You need to check all the config files including

    • The one in the project root
    • The one in the Views folder

    You could also do an assembly redirect in your config file to take care of this as well -- If its failing due to a third party lib this might be the most appropriate action to take.

    Based on your feedback id suggest using a binding redirect. Add this to your main web.config..

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.1" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    
    0 讨论(0)
  • 2021-01-12 01:48

    I had a similar problem where a MS update changed MVC.dll from 3.0.0.0 to 3.0.0.1. I need to maintain various versions of my software so to ensure compatibility I had to copy the 3.0.0.0 dll to my project and reference it there before building the project.

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