方法来确定的框架版本,未经注册方法来、框架、版本

2023-09-05 00:09:54 作者:走太远

我已经寻找了很长时间,但我无法找到答案。 有什么方法来确定安装在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();