5

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.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Pranit Kothari
  • 9,721
  • 10
  • 61
  • 137

3 Answers3

2

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.

vapcguy
  • 7,097
  • 1
  • 56
  • 52
StuffHappens
  • 6,457
  • 13
  • 70
  • 95
1

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.

Sandra
  • 608
  • 2
  • 11
  • 23
  • 1
    I don't think it is correct to use copy local, because parts of the framework probably should not be distributed with the application. More details here: https://stackoverflow.com/a/8185946/3195477 – StayOnTarget Jan 13 '22 at 21:37
  • Setting Copy Local to True (for PresentationFramework.Aero) worked for me. Great. – Miyamoto Musashi Nov 15 '22 at 18:58
1

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.

Johan Wintgens
  • 529
  • 7
  • 15