I have this code:
1: IUnityContainer container = new UnityContainer();
2: container.LoadConfiguration();
Line 1 works, but line 2 not. LoadConfiguration is not found as a member. I think, i have register all unity-dlls. Why is LoadConfiguration() not found?
I believe in the latest version of Unity 5.9.3, Microsoft.Practices.Unity dlls are not part of the nuget. You'd have to install another package from nuget 'Unity.Configuration'. Its an open source package offered by Unity. As of today, Unity Configuration latest version is 5.9.0.
Not only
Unity.Configuration package should be installed
but also
using Microsoft.Practices.Unity.Configuration;
should be declared at top of the cs file.
LoadConfiguration()
is not a member of IUnityContainer. You must be thinking of some other class or interface. Perhaps this one?
IUnityContainer
is in the Microsoft.Practices.Unity
namespace, but the LoadConfiguration()
extension method lives in the Microsoft.Practices.Unity.Configuration namespace. Have you added that namespace to your code?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With