I am looking at a legacy project that I am trying to get to build in Visual Studio 2010.

One of the projects (targeting .NET Framework 4) is refusing to play with a referenced DLL Microsoft.Practices.ServiceLocation (v2.0.50727). I get this error even though the reference is sound - even Intellisense seems to think it should work. Here is the using statement:

using Microsoft.Practices.ServiceLocation;

Are there any other libraries that I need to include? Is this a versioning issue? What's going on!?!

1

There are 1 answers

0
Basit Nizami On

I stumbled upon this same issue in one of my projects which was using .Net framework 4.0. What I did was to remove any references of Microsoft.Unity and reinstalled it using nuget with the following command.

Install-Package Unity -Version 2.1.505.2

The above was taken from the official nuget package page as found below.

https://www.nuget.org/packages/Unity/2.1.505.2

The catch is if you're using Unity version 3.5, then you should have .Net framework 4.5 because it doesn't work below that. For .Net framework 4.0, you need to use the above mentioned version because they are both compatible with each other.

Here, Microsoft really sucks again because of displaying a totally off error message. There should have been a proper helping error message regarding the compatibility.

I hope this helps.