UnityContainer () LoadConfiguration not found

I have this code:

1: IUnityContainer container = new UnityContainer(); 2: container.LoadConfiguration(); 

Line 1 works, but line 2 does not. LoadConfiguration was not found as a member. I think I registered all dll units. Why is LoadConfiguration () not found?

+10
source share
3 answers

LoadConfiguration() not a member of IUnityContainer . You should be thinking of some other class or interface. Maybe this one?

IUnityContainer is in the Microsoft.Practices.Unity namespace, but the LoadConfiguration() extension method is in the Microsoft.Practices.Unity.Configuration namespace. Have you added this namespace to your code?

+18
source

I believe that in the latest version of Unity 5.9.3, the Microsoft.Practices.Unity libraries are not part of nuget. You will need to install another package from nuget " Unity.Configuration ". This is an open source package offered by Unity. To date, the latest version of Unity Configuration is 5.9.0.

+5
source

Not only

Unity.Configuration package must be installed

but also

 using Microsoft.Practices.Unity.Configuration; 

should be declared at the top of the CS file.

0
source

Source: https://habr.com/ru/post/914660/


All Articles