Windows升级造成MVC3和MVC4停止工作工作、Windows

2023-09-02 01:23:08 作者:含着泪水说再见ぅ

我是谁10月15日安装Windows更新(8.1)只有一个,突然MVC停止,因为这个警告的工作?

  

警告1无法解析此引用。无法找到程序集​​System.Web.Mvc,版本= 4.0.0.0,文化=中性公钥= 31bf3856ad364e35,的ProcessorArchitecture = MSIL。检查以确保装配存在于磁盘上。如果此引用需要由您code,你可能会得到编译错误。

看来,这个Windows更新安装MVC的版本号为4.0.0.1的新版本,并删除​​旧版本的程序文件夹。

有人知道如何解决这个无爬行对每一个项目?

解决方案

最好的办法是更新的DLL 4.0.0.1版本。 尝试使用的NuGet:

 安装-包Microsoft.AspNet.Mvc -Version 4.0.40804 -Project<您的项目名称>
 

这将自动更新

 < dependentAssembly>
    < assemblyIdentity名=System.Web.Mvc公钥=31bf3856ad364e35/>
    < bindingRedirect oldVersion =0.0.0.0-4.0.0.1NEWVERSION =4.0.0.1/>
  < / dependentAssembly>
 

微软Win10更新后又陷舆论风波

您只需要在手动编辑的版本System.Web.Mvc:

 <编译调试=真正的targetFramework =4.0>
  <组件>
    <添加组件=System.Web.Mvc,版本= 4.0.0.1,文化=中性公钥= 31BF3856AD364E35/>
 

am i the only one who installed a Windows Update (8.1) on october 15, and suddenly MVC stop working because of this warning?

Warning 1 Could not resolve this reference. Could not locate the assembly "System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

It seems that this windows update installs a newer version of MVC with version number 4.0.0.1, and removes old version from program files folder.

Someone know how to fix this without crawling for each project?

解决方案

The best solution is update DLL to version 4.0.0.1. Try use nuget:

Install-Package Microsoft.AspNet.Mvc -Version 4.0.40804 -Project <your project name>

This will automatically update

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
  </dependentAssembly>

You just have to edit version System.Web.Mvc manually in:

<compilation debug="true" targetFramework="4.0">
  <assemblies>
    <add assembly="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />