针对.NET Framework 4的安装框架4.5时 [英] Targeting .NET Framework 4 when Framework 4.5 is installed

查看:568
本文介绍了针对.NET Framework 4的安装框架4.5时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装我的电脑上VS2010和VS2012,不得不在.NET Framework 4.0,然后我升级到.NET Framework 4.5。不过,我还是开发需要在.NET框架4.0的应用程序的工作。该项目说,它是针对.NET Framework 4的(客户端配置文件)的组件,甚至点在引用的程序集的.NET Framework 4.0文件夹中。问题是当我提出这个申请一个机器,只有4.0将不会启动,并拿出错误眼前的问题是从的WindowState = {结合的WindowState} ,你不能在4.0做,但你可以在4.5。我需要这个扔在我的开发之外,为什么不呢?我的假设是,尽管我尽了最大努力的是,它是否存在,他们使用了4.5的DLL。我怎样才能使它真正使用4.0没有卸载4.5?

I have VS2010 and VS2012 installed on my computer and had the .NET Framework 4.0 which I then upgraded to .NET Framework 4.5. However, I am still developing apps that need to work on .NET Framework 4.0. The project says that it is targeting .NET Framework 4 (Client Profile) the assemblies even point to .NET Framework 4.0 folder under Referenced Assemblies. The problem comes when I move this application to a machine that only has 4.0 it won't start and come up with errors the immediate problem being an exception resulting from WindowState={Binding WindowState} which you can't do in 4.0 but you can in 4.5. I need this to throw the exception on my development box, why doesn't it? My assumption is that despite my best efforts is that it uses the 4.5 dlls if they exist. How can I make it really use 4.0 without uninstall 4.5?

更新

要瑞普此安装.NET Framework 4.5,并创建一个WPF项目面向.NET Framework 4.0中。绑定的WindowState一个属性在一个虚拟机或代码背后使这个属性有一个公共的get和私人集。 .NET框架4.5处理这个问题就好了,即使模式=双向必须忽略组.NET Framework 4的不和抛出异常:一个双向或者OneWayToSource结合不能类型的只读属性国家工作.. 。在使用.NET框架箱4.5作品就像一个魅力试一试的机器上只的.NET Framework 4.0和它吹起来......于是就如何真正目标4.0安装4.5时,任何想法?

To repro this install .NET Framework 4.5 and create a WPF project targeting .NET Framework 4.0. Bind the WindowState to a property in a VM or code behind make this property have a public get and private set. .NET Framework 4.5 handles this just fine even when Mode=TwoWay must ignore the set .NET Framework 4 doesn't and throws an exception: "A TwoWay or OneWayToSource binding cannot work on the read-only property 'State' of type...". On the box with .NET Framework 4.5 works like a charm try it on a machine with only .NET Framework 4.0 and it blows up... So any ideas on how to really target 4.0 when 4.5 is installed?

到MS错误报告在这里:的 https://connect.microsoft.com/VisualStudio/feedback/details/774694/targeting-net-framework-4-0-when-4-5-doesnt-seem -to-工作

Bug report to MS here: https://connect.microsoft.com/VisualStudio/feedback/details/774694/targeting-net-framework-4-0-when-4-5-doesnt-seem-to-work

推荐答案

这似乎是在.NET框架4.5的一个错误,它应该抛出异常。但随着.NET框架4.5安装是没有办法对NET框架4.0它总是使用4.5应用程序运行。

This appears to be a bug in .NET Framework 4.5 and it should throw the exception but with .NET Framework 4.5 installed there is no way to have your application run on .NET framework 4.0 it will always use 4.5.

请参阅本报告的bug的详细信息:
http://connect.microsoft.com/VisualStudio/feedback/details/773682/wpf-property-with-private-setter-is-updated-by-a-twoway-binding

See this reported bug for more info: http://connect.microsoft.com/VisualStudio/feedback/details/773682/wpf-property-with-private-setter-is-updated-by-a-twoway-binding

这篇关于针对.NET Framework 4的安装框架4.5时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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