.Net framework Incompatibility Issues

I've a C# application that is targeted to .Net framework 3.5 version. The binary worked fine when .Net framework 3.5 is installed. But it is giving some incompatability isssues with .Net 4.0

I'm seeing the following exception:

Caught exception at Method: InitializeComponent Line: 0 Column: 0 Exception: Could not load file or assembly 'WindowsFormsIntegration, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.


I think that all the information you need to resolve this has already been posted in the comments, to summarise however:

The information you really need is in the posted exception (emphasis mine):

Could not load file or assembly 'WindowsFormsIntegration, Version=3.0.0.0

Its trying to load the .Net 3.0 version of WindowsFormsIntegration.dll but cannot find the file (or one of its dependencies) presumably this is because the .Net 3.0 framework is not installed on the client machine. Note that the .Net v4.0 framework is independent of previous version of the .Net framework - there is no guarentee that the .Net framework v3.0 will be availabe on a machine even if the .Net framework v4.0 is present.

If you install the .Net framework version 3.0 then your program should work again (barring other problems), however really if you are targetting the .Net 4.0 framework you should reference the .Net 4.0 version of WindowsFormsIntegration.dll . Simply remove the existing reference and add another reference to the .Net 4.0 version instead.

Note: the "Specific Version" property is a compiler-time setting that lets Visual Studio build even if it doesn't have access to the correct version, at runtime however this setting has no effect - the correct version of the assembly must be present. See What you need to know about referenced assemblies in VS2005

链接地址: http://www.djcxy.com/p/9774.html

上一篇: Inkscape:将SVG动画到视频?

下一篇: .Net框架不兼容问题