What is the minimum working implementation of an IVsTextViewCreationListener?

I created a VISX project and wrote this piece of code:

using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
using System.ComponentModel.Composition;

namespace MyExtension
    public class Main : IVsTextViewCreationListener
        public void VsTextViewCreated(IVsTextView textViewAdapter)


If I put a breakpoint inside the method VsTextViewCreated

, Visual Studio will tell me that it will never get hurt. Opening the files in a second instance of Visual Studio that runs in the debugger doesn't really call it.

What am I doing wrong?


source to share

1 answer

You need to specify ContentType and TextViewRole for your class:



Also don't forget to declare the MefComponent resource in your extension manifest: enter image description here



All Articles