Reputation: 641
I have inherited a WPF project that uses Prism and Unity that was originally written in .Net 4.5. I am upgrading the project to .net 4.7.1 and I am upgrading all the Unity and Prism packages to the latest revisions:
There are 5 projects, with the main project being the (WPF) desktop application that runs the bootstrapper. I get the following error (directly from bootstrapper.Run()) when running the application:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f' or one of its dependencies. The system cannot find the file specified.'
I have included the full stack trace at the bottom.
I have searched the appropriate places that I know of where dependency information would be available, namely Nuget and the app.config file but nothing stands out.
The missing file name in the stack trace is Microsoft.Practices.Unity, but all the versions of Unity that I have are now pointed to Unity.*.dll files.
This leads then to my question: What version of Unity is the Nuget package Prisim.Unity compiled against? Is Unity 5.8.11 supported? Do I need to add a Binding redirect? I'm okay with building from source if need be.
Any insight would be great, even if it's just confirmation that Prism 6.3.0 works with Unity 5.8.11 and I have made a mistake somewhere.
Thanks! Russ
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.Practices.Unity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f' or one of its dependencies. The system cannot find the file specified.
Source=Prism.Unity.Wpf
StackTrace:
at Prism.Unity.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
at Prism.Bootstrapper.Run()
at MYAPP1.Desktop.App.OnStartup(StartupEventArgs e) in C:\path\to\Project\MYAPP1\App.xaml.cs:line 20
at System.Windows.Application.<.ctor>b__1_0(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at MYAPP1.Desktop.App.Main() in C:\path\to\Project\MYAPP1\obj\Debug\App.g.cs:line 51
Upvotes: 1
Views: 2840
Reputation: 10873
What version of Unity is the Nuget package Prisim.Unity compiled against?
Looking at Nuget, it depends on Unity 4.0.1
Is Unity 5.8.11 supported?
Only from 7.0.0 onward, which are pre-release right now.
So you either stick with Prism 6.3 and Unity 4 or switch to prerelease Prism 7.
Upvotes: 0