.NET Framework 4的向后兼容 [英] Backwards Compatibility of .NET Framework 4

查看:181
本文介绍了.NET Framework 4的向后兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个WPF应用程序建立在.NET Framework 3.5的。

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

一些测试者发现,如果他们卸载.NET Framework 3.5的,但安装.NET Framework 4.0,我们的应用程序无法启动本身。

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

剂量这意味着.NET Framework 4.0中不包括所有3.5库,而用户必须安装.NET 3.5,即使他们有4.0?

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?

我在这里看到的是由微软列出了一些迁移问题 <一href="http://msdn.microsoft.com/en-us/library/ee941656.aspx#windows_$p$psentation_foundation_wpf">http://msdn.microsoft.com/en-us/library/ee941656.aspx#windows_$p$psentation_foundation_wpf

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?

感谢

推荐答案

净3.5 / 2.0的应用程序做的没有在.NET 4.0运行时自动运行。你必须明确指定你的应用程序,它应该通过增加在你的App.config运行在.NET 4.0中:

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

如果您有第三方组件,你还必须将它们标记为准备4.0:

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>

这篇关于.NET Framework 4的向后兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆