VS 2010鼠标处理器扩展 - 不工作 [英] VS 2010 mouse processor extension - not working

查看:258
本文介绍了VS 2010鼠标处理器扩展 - 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Visual Studio 2010的扩展,在这里我需要通过IMouseProcessor暴露的事件工作试验。

I am experimenting with a Visual Studio 2010 extension, where I need to work with the events exposed by IMouseProcessor.

据我可以从文档来讲,我应该创建一个IMouseProcessorProvider和出口是使用MEF,以便它可以由Visual Studio自动拾取。

As far as I can tell from the docs, I should create an IMouseProcessorProvider and export is using MEF, so that it can be automatically picked up by Visual Studio.

我创建这个类:

[Export(typeof(IMouseProcessorProvider))]
[ContentType("code")]
internal sealed class MouseProcessorFactory : IMouseProcessorProvider
{        
    public IMouseProcessor GetAssociatedProcessor(IWpfTextView wpfTextView)
    {
        return new MouseProcessor();
    }
}

当我运行Visual Studio的实验实例中我扩展名是在扩展管理器中可见。但我的定义鼠标的处理器供应商是永远不会被调用。我缺少的东西/我在做什么错了?

When I run the experimental instance of Visual Studio, my extension is visible in the extension manager. But my custom mouse processor provider is never being called. Am I missing something / What am I doing wrong ?

推荐答案

扩展Visual Studio 2010的UML设计 - 第1部分:入门

不幸的是一对夫妇在当前VSSDK Beta 2中的错误,我们必须解决。我被告知,他们将被固定在一个更新版本,但在那之前,让我带你通过所需的项目清理工作,使这项工作:

Unfortunately there are a couple of bugs in the current VSSDK Beta 2 that we have to work around. I’ve been told they will be fixed in an update release but until then, let me take you through the project cleanup required to make this work:

步骤1 - 调整中的.csproj文件


  1. 右键点击您的项目,然后选择卸载项目。

  2. 右键你的项目再次单击,然后选择编辑Yourprojectname.csproj

  3. 在最上面的属性组,查找XML标记< IncludeAssemblyInVSIXContainer> 。它将被设置为false。将其更改为true。

  4. 保存的.csproj文件并将其加载到Visual Studio。

  1. Right click on your project and choose "Unload Project".
  2. Right click again on your project and choose "Edit Yourprojectname.csproj"
  3. In the topmost property group, look for the XML tag <IncludeAssemblyInVSIXContainer>. It will be set to false. Change it to true.
  4. Save the .csproj file and reload it into Visual Studio.

第2步 - 调整的.vsixmanifest文件


  1. 右键单击该文件source.extension.vsixmanifest,并选择查看代码

  2. 在文件中的部分被称为底部添加以下行。 (是的,这些竖线是很重要的)

  1. Right click on the file "source.extension.vsixmanifest" and choose View Code
  2. At the bottom of the file in the section called add the following line. (Yes, those vertical bars are important.)

< MefComponent> |命名为yourprojectname |< / MefComponent>

保存并关闭文件。

这篇关于VS 2010鼠标处理器扩展 - 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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