Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Unity.Mvc4, but cannot get correct version of Microsoft.Practices.Unity

I am trying to install Unity.Mvc4 but I get this error message;

Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.1.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The version of Microsoft.Practices.Unity I have is 3.0.0.0. Why would I want an older version?

like image 444
arame3333 Avatar asked Feb 22 '26 23:02

arame3333


1 Answers

Unity.Mvc4 is a community project and references an older version of Unity. If you want to use Unity.Mvc4 you can get an older version of Unity from the Package Manager Console you should use the following (see this post for more information)

Install-Package Microsoft.Practices.Unity -Version <press tab key for autocomplete>

From personal experience: If you want or need to use newer versions of Unity (which has good support for MVC and Web API in version 3) you should try to get rid of packages like Unity.Mvc4 or Unity.WebApi. They are useful for older projects (where Unity 3 is not a choice), but for new projects Unity has all you normally need.

like image 79
Horizon_Net Avatar answered Feb 24 '26 20:02

Horizon_Net



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!