Unity 3.0 Preview for .NET 4.5

Unity has become a popular DI container with a solid base of users (last time I checked, there were 300K+ cumulative downloads of the Unity container through all channels – MSDN, Codeplex, and NuGet). Unity runs in the heart of Microsoft Exchange and Bing and many other systems. For all of you Unity fans and enthusiasts building Metro style apps for Windows 8 Developer Preview, we have ported the Unity dependency injection container to .NET 4.5 framework.

The Unity 3.0.1026.0 Preview enables Unity to work on .NET 4.5 with both the WinRT and desktop profiles.  The major changes include:

  • Unity projects updated to target .NET 4.5
  • Dynamic build plans modified to use compiled lambda expressions instead of Reflection.Emit
  • Converting reflection to use the new TypeInfo for reflection.
  • Projects updated to work with the Microsoft Visual Studio 2011 Preview.

Notes/Known Issues:

  • The Microsoft.Practices.Unity.UnityServiceLocator class cannot be used under the WinRT profile because the CommonServiceLocator cannot be used under the WinRT profile currently.
  • Only the core Unity libraries will work with the WinRT profile.  The Unity.Configuration, Unity.Interception, and Unity.Interception.Configuration assemblies will not work under the WinRT profile.
  • We removed the Silverlight versions for this preview.
  • Only unit tests from the Unity 2.1 suite have been verified. Full scale testing is to be done for the final release.
  • The preview release refers to the Unity 2.x documentation set.

Note, there are no new features in this preview. All new features (registration by convention, web-specific lifetimes like Per-HttpRequest, etc.) along with further perf optimizations are planned to be done as part of the Enterprise Library v6.0 (codenamed “Reinvented”) project. You are invited to submit and vote on features requests through our Uservoice site.

In the meantime, enjoy the Unity 3.0 preview and please provide feedback on it.

Kudos go to Bob Brumfield for he is the one who’s actually done the bulk of work on this preview release. Also, I’d like to acknowledge David Hill, Chris Tavares and Fernando Simonazzi who helped with the approach, code review, and provided early feedback.

Finally, you can get the Unity 3.0 Preview from Codeplex.

Comments (3)
  1. Kenneth Brubaker says:

    Why can't CommonServiceLocator be used?

  2. brumfb1 says:

    Internally, the CommonServiceLocator depends on IServiceProvider which isn't available in WinRT.  We just did not create a version of CSL for WinRT at this time.  In the future, if there is enough interest we could create a version of the CSL for WinRT.

  3. Sky says:

    You bet there is 🙂

Comments are closed.

Skip to main content