I am working on WPF application, which was first开发者_如何学编程 targeted to 3.0 framework. When I tried to make it work on 4.0, I got following Exception.
System.IO.FileNotFoundException was unhandled Message: Could not load file or assembly 'PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
If I compile application using .Net 4.0 it is working fine. But 3.0 exes are not working with 4.0.
Thanks in advance.
Try to remove the DLL reference to the PresentationFramework in your Visual Studio project, then retarget your application framework in the Project Properties, and then add PresentationFramework reference again.
I'm not sure why the PresentationFramework.Aero.dll was not present on the other system even though the expected version of .NET Framework was installed, but I didn't investigate too much.
Instead, in my solution, under References, I found that reference, and in the Properties of the reference, I changed Copy Local to True. This included the dll with my project output, and as a result, the other system was able to find it when the program ran.
Hope it helps someone.
I got this error after copy-pasting a TextBox in XAML which held an event trigger. Removing this from the newly copied TextBox resolved my issue.
I realize that this probably describes a very specific instance of the Exception, but I hope that it may help others resolve their problem.
精彩评论