织梦CMS - 轻松建站从此开始!

abg欧博官网|登陆|游戏|

当前位置: abg欧博官网|登陆|游戏| > abg欧博 > 文章页

Getting the .NET Framework directory path

时间:2025-12-12 07:00来源: 作者:admin 点击: 4 次
You can grab it from the Windows Registry: using System; using Microsoft.Win32; // ... public static string GetFrameworkDirectory() { // This

You can grab it from the Windows Registry:

using System; using Microsoft.Win32;

// ...

public static string GetFrameworkDirectory() { // This is the location of the .Net Framework Registry Key string framworkRegPath = @"Software\Microsoft\.NetFramework"; // Get a non-writable key from the registry RegistryKey netFramework = Registry.LocalMachine.OpenSubKey(framworkRegPath, false); // Retrieve the install root path for the framework string installRoot = netFramework.GetValue("InstallRoot").ToString(); // Retrieve the version of the framework executing this program string version = string.Format(@"v{0}.{1}.{2}\", Environment.Version.Major, Environment.Version.Minor, Environment.Version.Build); // Return the path of the framework return System.IO.Path.Combine(installRoot, version); }

Source

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-12-14 08:12 最后登录:2025-12-14 08:12
栏目列表
推荐内容