It's getting considerably easier to create and distribute Visual Studio Extensions. With Visual Studio 2008, you can find extensions at the Visual Studio Gallery. There's also a very good VSX (Visual Studio Extensibility) Developer Center on MSDN that has a ridiculous amount of information on how to extend VS, and there are LOTS of great VS 2008 add-ins. The documentation is really well fleshed-out. It also includes info on the little-known, but totally awesome "VS Shell," but that's another post.
创建和分发Visual Studio Extensions变得相当容易。 使用Visual Studio 2008,您可以在Visual Studio Gallery中找到扩展。 MSDN上还有一个很好的VSX(Visual Studio可扩展性)开发人员中心,其中提供了有关如何扩展VS的大量信息,并且还有很多出色的VS 2008加载项。 该文档确实充实。 它还包含有关鲜为人知但非常出色的“ VS Shell ”的信息,但这是另一篇文章。
Visual Studio 2010 Beta 1 shows some new and interesting was to extend VS. One nice way to say it is "moving beyond add-ins." One example is that the Editor in VS2010 uses MEF (Managed Extensibility Framework) at its heart. It also uses Immutable Text Snapshots that make accessing the buffer from other threads easier. I talked to Noah Richards, one of the devs on the editor, in a recent episode of my podcast.
Visual Studio 2010 Beta 1显示了一些新的有趣的扩展VS。 一种不错的说法是“超越外接程序”。 一个例子是,VS2010中的编辑器将MEF(托管扩展框架)作为核心。 它还使用不可变文本快照,使从其他线程访问缓冲区更加容易。 在我最近播客的一集中,我与编辑之一的开发人员Noah Richards进行了交谈。
Terry Clancy points out how much easier it is. Seriously, the post is of epic length, check it out.
特里·克兰西(Terry Clancy)指出,这样做要容易得多。 认真地,帖子是史诗般的长度,请检查出来。
For the Visual Studio 2010 Shell, we’ve made targeted investments to the developer experience:
对于Visual Studio 2010 Shell,我们根据开发人员的经验进行了有针对性的投资:
· No more complicated load keys! - Developers are no longer required to procure a Package Load Key (PLK) or a Shell Load Key (SLK) to develop Visual Studio 2010 Shell applications!
·没有更复杂的加载键! -不再需要开发人员购买程序包加载密钥(PLK)或Shell加载密钥(SLK)来开发Visual Studio 2010 Shell应用程序!
· No requirement for Registry. Packages can now be installed without requiring developers to update configuration settings in the Windows registry. In many cases, this means that packages can now be x-copy deployed.
·不需要注册表。 现在可以安装软件包,而无需开发人员更新Windows注册表中的配置设置。 在许多情况下,这意味着软件包现在可以进行x副本部署。
· Easier, more robust deployment – The redistributable shell installers have been updated to support Windows Installer source caching features, thus is during a repair, user’s won’t be required to point MSI to the original installation file or media.
·更轻松,更可靠的部署–可再发行的Shell安装程序已更新为支持Windows Installer源缓存功能,因此,在修复过程中,无需用户将MSI指向原始安装文件或媒体。
· Improved SDK tooling – New templates have been added to make it easier to get started with the Visual Studio Shell, and create common types of extensions. For Visual Studio Shell (Isolated Mode) developers, we’ve significantly improved performance of our F5 Debugging experience.
·改进的SDK工具-已添加新模板,以使使用Visual Studio Shell的入门和创建常见类型的扩展更加容易。 对于Visual Studio Shell(隔离模式)开发人员,我们显着提高了F5调试体验的性能。
So what does a VS2010 extension look like?
那么,VS2010扩展的外观如何?
使用Online Gallery和Extension Manager安装VS2010 Extension (Installing a VS2010 Extension with the Online Gallery and Extension Manager)
Doing my talk on .NET 4 at TechEd this year, I got to use a new extension from the folks at Clarius Consulting called the Demo Dashboard. The idea is that while you're giving a talk at a conference like TechEd, the audience is using Twitter and a hash-tag that you set (I used #scottha) to give you real time feedback on your presentation. They can tell you if you're doing a good job, if your fonts are the right size, your speed, and they'll also give you a headcount of twitter users in your talk.
在今年在TechEd上进行有关.NET 4的演讲时,我不得不使用Clarius Consulting员工的一个新扩展,称为Demo Dashboard 。 这个想法是,当您在TechEd之类的会议上进行演讲时,听众正在使用Twitter和您设置的井号标签(我使用#scottha)来为您的演示文稿提供实时反馈。 他们可以告诉您您是否做得很好,字体大小,速度是否合适,并且还可以在您的演讲中为Twitter用户提供一定数量的信息。
The code for the Demo Dashboard is up at Codeplex under Ms-PL while the extension itself is at the VS Gallery. It's actually a VS extension WITH extensions of it's own!
演示面板的代码位于Ms-PL下的Codeplex上,而扩展本身位于VS Gallery上。 它实际上是VS扩展,它具有自己的扩展!
The plugin integrates with the Editor and hangs around (it can be collapsed) while you're giving your talk. For my talk, I used a debug build and just dropped it into the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Components folder.
该插件与编辑器集成在一起,可以在您讲话时闲逛(可以折叠)。 在我的演讲中,我使用了一个调试版本,并将其放入C:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ Components文件夹中。
However, you can just go to the Extensions Manager and download it directly into Visual Studio:
但是,您可以转到Extensions Manager并将其直接下载到Visual Studio中:
If you download it manually from a website like the Visuals Studio Gallery, you'll notice the VSIX extension is associated with Visual Studio:
如果您从Visuals Studio Gallery之类的网站手动下载它,您会注意到VSIX扩展与Visual Studio相关联:
![File Download (2) File Download (2)](https://i-blog.csdnimg.cn/blog_migrate/f8dd0c80c00c8474f6ce6176e9c7ce8d.png)
You'll be warned that 'VSLauncher' is trying to run something, and if you accept it, the VSIXInstaller will do its thing. It's easier to just do it from inside the Extension Manager in Visual Studio.
将警告您“ VSLauncher”正在尝试运行某些内容,如果您接受它,则VSIXInstaller会执行其操作。 从Visual Studio的扩展管理器内部进行操作会更容易。
The Demo Dashboard is entirely written in managed code and is actually a WPF app. Notice in this screenshot of the main XAML file that the plugin is actually running inside the WPF editor at the bottom of the split-screen view.
Demo Dashboard完全用托管代码编写,实际上是WPF应用程序。 请注意,在此主要XAML文件的屏幕快照中,该插件实际上在拆分屏幕视图底部的WPF编辑器中运行。
They Demo Dashboard folks created a whole sub-plugin model you can use to extend this dashboard for your own conference. Using MEF (now built into .NET 4), they're pulling in a Twitter Service, and having Widget DLLs provide one or more widgets.
他们的演示仪表板人员创建了一个完整的子插件模型,您可以使用该模型为您自己的会议扩展此仪表板。 他们使用MEF (现已内置于.NET 4中)来引入Twitter服务,并让Widget DLL提供一个或多个Widget。
namespace CoolnessWidget
{
[Export(typeof(IWidgetProvider))]
[Widget(Name = "Cool Widget", After = "Font Size Widget")]
internal class CoolWidgetProvider : IWidgetProvider
{
IEnumerable<IWidget> IWidgetProvider.GetWidgets(Context context)
{
// creates an instance of our widget providing it the core context and twitter service to work with
CoolWidget widget = new CoolWidget(context, this.TwitterService);
return new List<IWidget> { widget };
}
[Import]
private TwitterService TwitterService { get; set; }
}
}
There's a lot of great examples in the code on clever ways to use MEF to make consumption of services easier by plugins. The WidgetManager class brings together a bunch or "hard to deal with" classes, then Exports them via MEF to make consumption easier by other classes and plugins downstream.
代码中有很多很棒的例子,介绍了使用MEF的聪明方法,以使插件更容易使用服务。 WidgetManager类将一堆或“难以处理”的类聚集在一起,然后通过MEF导出它们,以使下游的其他类和插件更容易使用。
I think, however that it could be even MEFier. Remember, it's Ms-PL, and a CodePlex project, and there's a lot of TODO:'s marked in the comments, do we're free to change and improve the code. Go check it out.
我认为,但是它甚至可能是MEFier。 记住,这是Ms-PL和一个CodePlex项目,并且注释中标记了很多TODO:是否可以自由更改和改进代码。 去看看吧。
Related Links
相关链接
MSDN Docs - Extending the Visual Studio Environment
MSDN文档-扩展Visual Studio环境