1
votes

So I have a WPF application that is using Prism Composition to handle modularity. One of my libraries that contains my Prism IModule, references a Portable Class Library. When I attempt to run my WPF application I get the following exception:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.Practices.Prism.Composition.dll Could not load file or assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

This occurs inside the InitializeModules of my UntiyBootstrapper implementation. I am pretty sure this is because Prism is trying to load all the dependencies of the library containing my Prism IModule but I don't quite understand why it can't find that dependency. So far I have tried reinstalling the Windows 8.1 SDK because I read that is where that DLL should reside.

Has anybody else encountered this before or have any suggestions?

Update: I found that if I copy the System.Runtime.dll from this location: "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5.1" and place it in the same location as my WPF exe then everything runs fine. I don't quite understand why the Prism library can't load this DLL then. Is it a limitation of Prism because I don't see the System.Runtime.dll in the GAC so how does is that dependency normally resolved?

2
Do you have ReSharper installed? This is a known issue with Resharper when you shelve or unshelve changes.Scott Chamberlain
No, I don't. This error happens when I attempt to run my project that is dynamically loading Modules using the Prism library.Eric Mattison

2 Answers

0
votes

I don't think its Prism, if you create a wpf app, which then references a different library, and that library is depended on another one. Then your main wpf application needs reference to both of them.

0
votes

It appears from my research that there is no way around this limitation in the Prism Library other than copying the dummy DLL from "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5.1". While this works for development, it would not be a practical option for deployment and therefore I have decided to just revert my PCL to a standard class library.

I came to my conclusion because after using a decompiler I saw that both System.Runtime.dlls for the targets I specified were set as references in my PCL and it appears the Prism library just attempts to load all the dependencies. This doesn't work for a PCL because one of the System.Runtime.dlls would be missing in every case.