如何在Visual Studio中直接使用示例代码浏览器搜索下载和管理代码示例

今天微软一站式示例代码库团队发布了示例代码浏览器的Visual Studio 扩展。有了它,开发人员就可以在Visual Studio 2010里直接通过Alt+F1快捷键搜索示例代码,并方便地对示例代码进行下载和管理。

image

你可以在 http://visualstudiogallery.msdn.microsoft.com/4934b087-e6cc-44dd-b992-a71f00a2a6df 点击安装。也可以通过Visual Studio 2010的Extension Manager 中搜索 Sample Brower 并安装。

image

安装后Sample Browser 会出现在Visual Studio 2010的Tools菜单中。

image

当你在Visual Studio中编写代码时,你也可以选中代码片段或API,在右键菜单中选择 “Search Code Sample” (或使用Alt+F1快捷键)。这同样会启动Sample Browser。Sample Browser会自动根据你所选中的代码片段或API搜索相关的代码示例,并根据你当前项目的编程语言过滤搜索结果。

image

FAQs

Q: 如果我只有Visual Studio 2010的Express版本,能否使用Sample Browser?

A: 虽然Visual Studio 2010的Express版本不支持扩展功能(即所有Visual Studio Extension包括Sample Browser Extension都无法在Express版本中使用),你仍可以使用我们提供的独立运行的Sample Browser

Q: 该Sample Browser扩展是否支持Visual Studio 2008?

A: 目前不支持。但如果有很多客户都希望添加对Visual Studio 2008的支持,我们会加上。

Q: 当我搜索示例的时候,遇到了"The remote name could not be resolved”或“The proxy cannot be resolved”错误。如何处理?

A: 这是由于网络造成的。请检查你的网络是否工作正常。如果你的网络使用了代理,请在Sample Browser的Settings里配置代理。

Q: 为什么Alt-F1快捷键不起作用?

A: 在你的Visual Studio 2010环境中,Alt+F1快捷键已经被赋给了其他的Visual Studio命令。请打开Visual Studio Tools / Options菜单项。转到Environment / Keyboard 页面。在"Press shortcut keys…” 文本框中按下Alt+F1,并检查Shortcut currently used by: 列表是否选中了EditorContextmenus.CodeWindow.SearchCodeSample命令。如果不是,你可以在Show commands containing:中打入EditorContextmenus.CodeWindow.SearchCodeSample,然后点击Assign.

image

如果你对该extension有任何反馈意见,欢迎发邮件至onecode@microsoft.com

特别感谢

Leco Lin开发并完成了该Sample Browser VS 扩展工作。Qi Fu测试并消灭了不少bug。Yi-Feng Li - VSX大牛 和Ming Zhu WPF大牛在开发过程中给予了Leco大量的帮助。还要感谢Lissa Dai设计的UI。以及微软内部大量的volunteer 帮忙使用了该插件并提供的建议。

原文地址:https://www.cnblogs.com/Jialiang/p/SampleBrowserVSX.html