Upgrading from Unity 1.2 to Unity 2.0

Jan 18, 2013 at 9:29 AM

Hi,

I am upgrading my existing code which uses Microsoft.Practices.Unity 1.2 to use Microsoft.Practices.Unity 2.0.

However when I am building the code I am facing Compilation errors as follows:

  •  Microsoft.Practices.Unity.IUnityContainer' does not contain a definition for 'RegisterInstance' and the best extension method overload 'Microsoft.Practices.Unity.UnityContainerExtensions.RegisterInstance<TInterface>(Microsoft.Practices.Unity.IUnityContainer, TInterface)'   has some invalid arguments
  • The non-generic method 'Microsoft.Practices.Unity.IUnityContainer.RegisterType(System.Type, System.Type, string, Microsoft.Practices.Unity.LifetimeManager, params Microsoft.Practices.Unity.InjectionMember[])' cannot be used with type arguments
  • 'Microsoft.Advertising.ServiceLocation.UnityServiceLocator' does not contain a definition for 'RegisterType' and no extension method 'RegisterType' accepting a first argument of type 'Microsoft.Advertising.ServiceLocation.UnityServiceLocator' could be found (are you missing a using directive or an assembly reference?) 

Can someone help me to resolve these errors by pointing to what equivalent API's are available in Unity 2.0 for Unity 1.2 methods?

Regards,

Krishnaraj V.

 

Jan 24, 2013 at 4:34 AM

It's hard to know what the issue is (besides re-iterating the compiler messages) without seeing the code.

Can you post some code snippets that reproduce the problem?  

Thanks,

--
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to