如何获得目标的.NET Framework版本? [英] How to get the version of the .NET Framework being targeted?

查看:63
本文介绍了如何获得目标的.NET Framework版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取要定位的.NET Framework版本,而不是应用程序当前在其下运行的.NET Framework版本?

How can i get the version of the .NET Framework i am targeting, rather than the version of the .NET framework the app is currently running under?

例如,如果应用程序针对.NET Framework 4.5,则我需要知道自己针对.NET Framework 4.5.

For example, if the application targets .NET Framework 4.5, i would need to know that i am targeting .NET Framework 4.5.

例如,检查 System.Environment.Version :

  • 在面向.NET Framework 4时: 4.0.30319.18502
  • 定位.NET Framework 4.5时: 4.0.30319.18502

所以那行不通.

真正的目标是尝试解决

The real goal is to try to work around the lack of compiler defines in .NET.

推荐答案

这很简单-检查 查看全文

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