C# IVsTextViewCreationListener don';2012年至2013年VSIX项目更新后无法工作
我有一个针对VisualStudio2012的VSIX项目,它运行良好。 但当我更新项目以Visual Studio 2013为目标时。 未调用以下函数“VsTextViewCreated”C# IVsTextViewCreationListener don';2012年至2013年VSIX项目更新后无法工作,c#,visual-studio-2013,vsix,C#,Visual Studio 2013,Vsix,我有一个针对VisualStudio2012的VSIX项目,它运行良好。 但当我更新项目以Visual Studio 2013为目标时。 未调用以下函数“VsTextViewCreated” using Microsoft.VisualStudio.Editor; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.
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\yourusername\AppData\Local\yourCompanyName”
和
“C:\Users\yourusername\AppData\Local\Microsoft\VisualStudio\12.0Exp”
另外,修改VSIXxShellExtensions清单文件并将包标记为“MEFComponent”
这也是一个很好的话题: