Why can't I display the ASP.NET Framework version as 3.5?

﹥>﹥吖頭↗ 提交于 2019-12-12 11:35:26

问题


Can someone please confirm to me that when my application is written in .NET 3.5 that this code

System.Environment.Version.Major.ToString()

will produce this

2.0.50727.1433

I'm just moving to 3.5 and the first application I'm moving is an internal website. I thought a really easy indicator that it's working would be to add the Framework version next to my Application version but the above text is what is being produced.

My limited research suggests that .NET 3.5 is a 'flavour' of 2.0 and so the underlying framework version will continue to be 2.0. The IIS application pool settings suggest this is the case.

Is this correct or can I get my application to show 3.5?

Cheers


回答1:


Because .NET 3.5 uses CLR runtime version 2. 3.5 is just a set of assemblies built on top of the 2.0 runtime. The internal APIs cannot tell the difference. Here is some code that will tell you whether 3.5 is present:

http://blogs.msdn.com/astebner/archive/2007/11/29/6608419.aspx

Note this will not tell you whether your code is actually running against 3.5, but you should be taking care of that in your manifest anyway.



来源:https://stackoverflow.com/questions/420941/why-cant-i-display-the-asp-net-framework-version-as-3-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!