问题
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.
回答1:
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.
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/5933189/changed-framework-version-results-in-could-not-load-file-or-assembly-presentati