方法来确定的框架版本,未经注册 [英] Way to determine framework version without Registry

查看:136
本文介绍了方法来确定的框架版本,未经注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经寻找了很长时间,但我无法找到答案。 有什么方法来确定安装在PC架构和服务包.NET,无法获得登记在C#中? 我可以使用注册表项,但我不得不这样做没有获得注册。 我读了一些关于C语言的目录:\ WINDOWS \微软.NET,但是,我只找到framework版本,一无所知SP。但我需要的框架和服务包。 有人可以帮我吗?

问候,格雷格

解决方案

 字符串CLRVERSION = System.Environment.Version.ToString();
字符串dotNetVersion =大会
                      .GetExecutingAssembly()
                      .GetReferencedAssemblies()
                      。凡。(X => x.Name ==mscorlib程序)第一()Version.ToString();
 

I've searching a long time, but i couldn't find answer. Is there any way to determine framework and service pack .NET installed on PC, without access to registry in C#? I can use registry keys, but i have to do this without access to registry. I read something about directories in C:\Windows\Microsoft .NET, but there, I only found framework version, nothing about SP. But I need framework and Service Pack. Can somebody help me?

Regards, Greg

解决方案

string clrVersion = System.Environment.Version.ToString();
string dotNetVersion = Assembly
                      .GetExecutingAssembly()
                      .GetReferencedAssemblies()
                      .Where(x => x.Name == "mscorlib").First().Version.ToString();

这篇关于方法来确定的框架版本,未经注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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