4

I’ve upgraded my project today to Prism 6.3.0 and Unity 5.3.1. Before that, I had Prism 5 and Unity 4.

Now I’m running into problems with the Prism.Unity.UnityBootstrapper: it seems that the Container field is still a Microsoft.Practices.Unity.IUnityContainer instead of Unity.IUnityContainer.

I had hoped that the upgrade would cleanly cut all references to Microsoft.Practices.Unity off of my project, but it seems that I’m still forced to use the “old” Prism library, at least in parts.

Why does this situation arise, and what do I do to make it right? Am I missing something?

Informagic
  • 1,132
  • 1
  • 11
  • 23
  • Unity 5.x is not supported in Prism yet. You will have to stick with 4.x until that happens. My understanding is it is a goal of the team to support Unity 5.x in Prism 7 and up. – R. Richards Nov 29 '17 at 00:03
  • Yes, this seems to be the case. I’ve read the edit history of `UnityBootstrapper.cs` on [GitHub](https://github.com/PrismLibrary/Prism/blob/master/Source/Wpf/Prism.Unity.Wpf/UnityBootstrapper.cs), and it agrees with what you wrote, @R.Richards. Please post your comment as answer and I’ll accept it. – Informagic Nov 29 '17 at 11:05

1 Answers1

3

Unity 5.x is not supported in Prism yet. So, you will have to stick with 4.x until that happens. My understanding is, it is a goal of the team to support Unity 5.x in Prism 7 and up.

As you mentioned in your comment, there has been a lot of talk in the GitHub repo for Prism about the changes that came along with Unity 5. Glad to know that there are people willing to take on Unity, and move it forward, though.

R. Richards
  • 24,603
  • 10
  • 64
  • 64
  • Absolutely. I’m also glad that Prism 7 is going to support Unity 5. I’ll downgrade the project for now; we’ll not release it anyway for another couple of months. – Informagic Nov 29 '17 at 21:42
  • 1
    A quick update: the problem prevails with Prism.Core 7.0.0.396, since the `UnityBootstrapper` of Prism.Unity 6.3.0 still relies on `Microsoft.Practices.Unity.IUnityContainer` instead of `Unity.IUnityContainer` (from Unity 5.6.0). So install Prism.Core as suggested on their GitHub page, but don’t update it yet via NuGet. – Informagic Feb 20 '18 at 09:12
  • Another update: I successfully upgraded my project to Prism 7.1.0.431 and Unity 5.8.11. Since it’s now deprecated, I removed the `UnityBootstrapper` and my application’s `Bootstrapper` class entirely and changed the `App.xaml.cs` to `PrismApplication` instead of `Application`. Some more replumbing was required, made somewhat a hassle due to the lack of proper migration documents, but I ended up with code that was, again, a little cleaner than before. Prism really rocks! – Informagic Nov 19 '18 at 08:19