System.Web.Mvc not functioning as expected after Windows Update

半世苍凉 提交于 2019-11-27 19:35:10

The recent updates have incremented version numbers

3.0.0.0 -> 3.0.0.1 and 4.0.0.0 -> 4.0.0.1

I had to remove the reference and re-add (System.Web.Mvc is found in Assemblies >Extensions are of the Add Reference dialogue)

I have same problem today after windows update. There is my solution.

Install-Package Microsoft.AspNet.Mvc -Version 5.2.0.0 -Project PROJECTNAME

Also you can try use these code maybe it helps.

Uninstall-Package Microsoft.AspNet.Mvc -Force

Goodluck.

There are two ways to fix this:

Option 1: Add Microsoft.AspNet.Mvc using NuGet

Use NuGet to add the latest revision of the MVC version you depend on to your project. Microsft recommends this approach.

Option 2: Update assembly reference

If you add a new assymbly reference to your project you'll see that the System.Web.Mvc assemblies are now versioned x.0.0.1.


Source: http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx

I would suggest against bluntly attempting reinstalling MVC. Allthough it worked for me in the end, you'll run into trouble with NuGet being bundled with the MVC installer.

You need to uninstall NuGet prior to reinstalling MVC because NuGet still being present causes the MVC installer to refuse to install or to fail.

In addition I don't see why reinstalling MVC will prevent Windows Update from applying the update again after you reinstalled MVC.

As the patch has incremented the version number has risen from (for MVC4 it has risen from 4.0.0.0 to 4.0.0.1) the Reference Path in the project files needs to change from:

<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <Private>True</Private>
  <HintPath>..\bin\System.Web.Mvc.dll</HintPath>
</Reference>

to

<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\bin\System.Web.Mvc.dll</HintPath>
</Reference>

Obviously adjust the hint path as appropriate, and make similar changes for other versions of MVC

We have the same problem.
Microsoft changed the Version from 3.0.0.0 to 3.0.0.1
I guess this is the reason Visual Studio can't find the reference, because the regular setting is "Use specific version - true".
In my case i can't change the setting to false, because I am using Mvc4 on the same machine and it would automatically use the version 4 dll.

A solution is to remove the project reference of System.Web.Mvc.dll and add it again. Then VS will use the Version-3.0.0.1-DLL as a reference.

Reinstall the MVC assembly

download link : http://www.microsoft.com/en-US/download/details.aspx?id=30683

matt

I tried mh28's solution, which proposed the following:

The recent updates have incremented version numbers

3.0.0.0 -> 3.0.0.1 and 4.0.0.0 -> 4.0.0.1

I had to remove the reference and re-add (System.Web.Mvc is found in Assemblies >Extensions are of the Add Reference dialogue)

On top of that, it was also suggested that I run a Find and Replace throughout my scope of interest; I tried that, but failed. Seems like Find and Replace doesn't apply to .csproj files.

What I did next was to find a text replacing tool (see Ecobyte Replace Text) and run the program using the following settings:

All my projects built as per normal thereafter, and I'm not seeing any side effects (despite not making any changes in the web.config files). I'm not sure (and I don't think) this is the best solution, and I don't think this is a silver bullet for all System.Web.Mvc issues affected by the security-related Windows Update for .NET, but I think it'd be useful for specific cases whereby there're a whole lot of projects to re-reference.

Oleg

Try to install/repair ASP.NET MVC using the last versions of MSI packages available from here.

If you use bindingRedirect in web.config it could be required (it was not needed in my projects) to update the sections too. See the answer. It all still not helps I would recommend to examine other web.config files in your project, like ~/Views/web.config for example.

I had same issue recently.

After Windows Update - my project in Visual Studio suddenly had 500+ errors - all related to system.web.mvc

So I deleted the reference and re-added it - found in C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies

Great - project compiles.

Put it on site - get "Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information"

After much messing around, I went to site, downloaded the version of it off there - referenced it - it worked on my laptop AND on site

phew!!!!!!!

This issue was present for me. However, the fix was much more simplified than using nuget to fix or making updates to web.config. My issue was resolved by manually updating the text in {ProjectName}.csproj from

Reference Include="System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"

to

Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" , and checking in the changes, and running a build in the build agent machine, which, for me, was TeamCity.

Even though this caused build errors locally, it resolved the source control/Team City build errors.

I realize that this doesnt allow me to build locally, without having making changes to the csproj file. However, after I checkin the change as I did above(changing it from 3.0.0.1 to 3.0.0.0), I can update the project locally to use the new version (3.0.0.1), and just not check in the changes to csproj. I imagine someone may have a similar scenario.

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