Changed framework version results in: Could not load file or assembly PresentationFramework?

天大地大妈咪最大 提交于 2021-01-27 05:32:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!