Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backwards Compatibility of .NET Framework 4

Tags:

.net

wpf

.net-4.0

We have an WPF Application build on .net framework 3.5.

Some testers find if they uninstall .net framework 3.5, but install .net framework 4.0, our APP fails to launch itself.

Dose this mean that .net framework 4.0 does not include all 3.5 libs, and users have to install .net 3.5 even though they have 4.0?

I see here are some migration issues listed by Microsoft http://msdn.microsoft.com/en-us/library/ee941656.aspx#windows_presentation_foundation_wpf

Are they all breaking changes so that the backward compatibility is ruined?

Thanks

like image 641
wuminqi Avatar asked May 12 '10 07:05

wuminqi


1 Answers

.Net 3.5/2.0 Applications do not automatically run on the .Net 4.0 runtime. You have to specify explicitly for your application that it should run on .Net 4.0 in your App.config by adding:

<configuration>
  <startup>
    <supportedRuntime version="v4.0" /> 
  </startup>
</configuration>

In case you have third party components you also have to mark them as being ready for 4.0:

<configuration>
   ...
   <runtime>
      ...
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         ...
         <dependentAssembly>
            <assemblyIdentity name="AssemblyName" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="3.5.0.0-3.5.0.0" newVersion="4.0.0.0"/>
         </dependentAssembly>
         ...
      </assemblyBinding>
      ...
   </runtime>
   ...
</configuration>
like image 86
Foxfire Avatar answered Oct 06 '22 02:10

Foxfire