Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
831 views
in Technique[技术] by (71.8m points)

wpf - Backwards Compatibility of .NET Framework 4

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

.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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...