0

Accidently I had deleted a reference of System.Web.Mvc of version "5.0.0.0" in my web api project,now when I tried to build it,it successfully builds and adds a dll of of System.Web.Mvc of version "4.0.0.0".Now when I run it I got error

Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

In my web config following lines are written

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

When i remove the auto added dll of 'System.Web.Mvc' and adds a dll of 'System.Web.Mvc, Version=5.0.0.0' from my nuget packages 'Microsoft.AspNet.Mvc.5.0.0' error disappears.

My question is from which location i should add my deleted dll or how to restore my accidently deleted dll?

2
  • try uninstall and then install Microsoft ASP.NET MVC with nuget Commented Nov 26, 2014 at 7:12
  • The location where Nuget package is downloaded is correct. Commented Nov 26, 2014 at 7:45

1 Answer 1

2

My question is from which location i should add my deleted dll or how to restore my accidently deleted dll?

There are two action here:

  1. If you deleted the dll itself

  2. If you have deleted a reference to the dll

To handle first case, you will have to restore the Nuget package, that's it. For more information on package restore, check this link

To handle second case which you mentioned in your question in very first line, just add a reference to the dll. The dll location is same as where you Nuget package is downloaded.

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.