我有一个针对 Visual Studio 2012 的 VSIX 项目,它运行良好。 但是当我更新项目以针对 Visual Studio 2013 时。 未调用后续函数“VsTextViewCreated”
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.VisualStudio.Utilities;
using SnippetsUI;
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VSIXProject1
{
class CompletionHandler
{
[Export(typeof(IVsTextViewCreationListener))]
[ContentType("CSharp")]
[Name("CodeCompletionTypeZero")]
[TextViewRole(PredefinedTextViewRoles.Editable)]
internal class CompletionHandlerProvider : IVsTextViewCreationListener
{
[Import]
internal IVsEditorAdaptersFactoryService _adapterService = null;
[Import]
internal ICompletionBroker _completionBroker { get; set; }
[Import]
internal SVsServiceProvider _serviceProvider { get; set; }
public void VsTextViewCreated(IVsTextView textViewAdapter)
{
Printer.Print("VsTextViewCreated");
ITextView textView = _adapterService.GetWpfTextView(textViewAdapter);
if (textView == null)
{
return;
}
return;
}
}
}
}
此外,如果我想在这一行设置一个断点:“Printer.Print("VsTextViewCreated");" 我得到“当前不会命中断点。没有为该文档加载任何符号”
感谢所有读到这里的人:)
最佳答案
删除
“C:\Users\您的用户名\AppData\Local\您的公司名称” 和 "C:\Users\你的用户名\AppData\Local\Microsoft\VisualStudio\12.0Exp"
此外,修改您的 VSIXxShellExtensions list 文件并将您的包标记为“MEFComponent”。
这也是个好话题:VSIX extension for VS2012 not running when debugging
关于c# - IVsTextViewCreationListener 在 VSIX 项目从 2012 年更新到 2013 年后不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20188402/