4

私は Visual Studio Extensibility を初めて使用し、VS 2012 SDK ( Displaying Statement Complete ) から Microsoft ウォークスルーの 1 つを実装しようとしています。ウォークスルーの 1 つのクラスで問題が発生しています。SVsServiceProvider問題は、定義されていないエラーが発生することです。を輸入しMicrosoft.VisualStudio.Shellました。

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.ComponentModel.Composition
Imports System.Runtime.InteropServices
Imports Microsoft.VisualStudio
Imports Microsoft.VisualStudio.Editor
Imports Microsoft.VisualStudio.Language.Intellisense
Imports Microsoft.VisualStudio.OLE.Interop
Imports Microsoft.VisualStudio.Shell
Imports Microsoft.VisualStudio.Text
Imports Microsoft.VisualStudio.Text.Editor
Imports Microsoft.VisualStudio.TextManager.Interop
Imports Microsoft.VisualStudio.Utilities


<Export(GetType(IVsTextViewCreationListener))>
<Name("token completion handler")>
<ContentType("plaintext")> <TextViewRole(PredefinedTextViewRoles.Editable)>
Friend Class TestCompletionHandlerProvider
Implements IVsTextViewCreationListener

<Import()>
Friend AdapterService As IVsEditorAdaptersFactoryService = Nothing
<Import()>
Friend Property CompletionBroker() As ICompletionBroker
<Import()>
Friend Property ServiceProvider() As SVsServiceProvider

Public Sub VsTextViewCreated(ByVal textViewAdapter As IVsTextView) Implements IVsTextViewCreationListener.VsTextViewCreated
    Dim textView As ITextView = AdapterService.GetWpfTextView(textViewAdapter)
    If textView Is Nothing Then
        Return
    End If

    Dim createCommandHandler As Func(Of TestCompletionCommandHandler) = Function() New TestCompletionCommandHandler(textViewAdapter, textView, Me)
    textView.Properties.GetOrCreateSingletonProperty(createCommandHandler)
End Sub
4

1 に答える 1

2

元の質問のコメントにサイモンが投稿したように、次への参照を追加します。

Microsoft.VisualStudio.Shell.Immutable.10.0.dll

を使用している場合はMicrosoft.VisualStudio.Shell.Immutable.11.0.dll、 null が発生しますSvsServiceProvider

于 2016-04-09T22:28:32.887 に答える