以编程方式查找 VS2017 最近使用 (MRU) 解决方案和项目 [英] Programmatically finding the VS2017 Most Recently Used (MRU) solutions and projects

查看:16
本文介绍了以编程方式查找 VS2017 最近使用 (MRU) 解决方案和项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 Visual Studio 2017 现在支持所有 SKU(企业版、专业版和社区版)的无注册并行安装这里.

I know that Visual Studio 2017 now supports no-registry, side-by-side installations of all SKUs (Enterprise, Professional and Community) explanations here.

我们需要访问 VS2017 最近使用 (MRU) 解决方案和项目的列表.

We need to access the list of VS2017 Most Recently Used (MRU) solutions and projects.

对于以前的 VS2017 版本,我们曾经为此查询注册表.

For previous VS2017 version we used to query the registry for that.

  • 此注册表查询代码在 VS2017 devenv 进程内部运行时仍然可以正常工作,
  • 但是当它在独立/自定义进程(我的意思是不是 VS2017 devenv 进程的进程)中执行时它不再工作了这是我们需要做的.

理想情况下,这可以通过 VS setup API 完成,但我找不到任何示例代码.

Ideally this could be done from the VS setup API but I cannot find any sample code.

否则我们仍然可以依赖 RegLoadAppKey() 函数,如本 VS 2017 重大变更文章(欢迎任何代码)

Else we can still rely on the RegLoadAppKey() function as explained in this VS 2017 breaking change article (any code is welcome)

或者也许还有其他 API 可以做到这一点?

Or maybe there is another API to do that?

感谢您的帮助,

推荐答案

访问 VS 2017 设置的推荐方法是使用 外部设置管理器:

The recommended way to access VS 2017 settings is to use the External Settings Manager:

ExternalSettingsManager ext = ExternalSettingsManager.CreateForApplication(@"C:Program Files (x86)Microsoft Visual Studio2017EnterpriseCommon7IDEdevenv.exe");
SettingsStore store = ext.GetReadOnlySettingsStore(SettingsScope.UserSettings);
foreach (string name in store.GetPropertyNames(@"MRUItems{a9c4a31f-f9cb-47a9-abc0-49ce82d0b3ac}Items"))
{
    string value = store.GetString(@"MRUItems{a9c4a31f-f9cb-47a9-abc0-49ce82d0b3ac}Items", name);
    Console.WriteLine("Property name: {0}, value: {1}", name, value);
}

要使用外部设置管理器,您需要将 Microsoft.VisualStudio.Settings.15.0.dll 的引用添加到您的项目中.

To use the External Settings Manager you need to add a reference to Microsoft.VisualStudio.Settings.15.0.dll to your project.

这篇关于以编程方式查找 VS2017 最近使用 (MRU) 解决方案和项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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