Adding bindingRedirect element in web.config when upgrading from asp.net mvc 1 to asp.net mvc 2

坚强是说给别人听的谎言 提交于 2019-12-11 15:44:46

问题


I have got a question with regards to upgrading asp.net mvc applications from v1 to v2...

I've noticed in the ASP.NET MVC v2 Release notes that we need to add this code (please see below) when upgrading, but it did not state what would be the purpose of it because I've tried experimenting some of my apps to asp.net mvc 2 without adding this particular section in web.config.

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

Would there be implications should I not place this?

Thanks!


回答1:


What this code does is pretty much tells your entire project that if there happen to be any old leftover references to MVC 1.0, then it should instead go try and use the 2.0 version instead. And I believe this would be inherited by class libraries as well where you might forget to update references.



来源:https://stackoverflow.com/questions/2542587/adding-bindingredirect-element-in-web-config-when-upgrading-from-asp-net-mvc-1-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!