none
sql server management studio 新建查询报错 RRS feed

  • 問題

  • 错误如下:

    标题: Microsoft SQL Server Management Studio
    ------------------------------

    预期具有协定名称“Microsoft.VisualStudio.Utilities.IContentTypeRegistryService”的 1 导出,但在实施相应约束后发现 0。 (mscorlib)

    程序位置:

       在 Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition)
       在 Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality)
       在 Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName)
       在 Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T](String contractName)
       在 Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T]()
       在 Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]()
       在 Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]()
       在 Microsoft.VisualStudio.Editor.Implementation.EditorParts.get_ContentTypeRegistryService()
       在 Microsoft.VisualStudio.Editor.Implementation.LanguageServiceToContentTypeMapper.MakeLanguageServiceContentTypes(SettingsStore settingsStore)
       在 Microsoft.VisualStudio.Editor.Implementation.LanguageServiceToContentTypeMapper.InitLanguageServiceToContentTypeMapper(IServiceProvider serviceProvider)
       在 Microsoft.VisualStudio.Editor.Implementation.TextDocData.SetSite(Object pUnkSite)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextBuffer.SetSite(Object serviceProvider)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextEditorControl.CreateAndInitTextBuffer(Object sp)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptEditorControl.Initialize(Object sp)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptAndResultsEditorControl.Initialize(Object sp)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.SqlScriptEditorControl.Initialize(Object sp, String moniker)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.SqlScriptEditorControl.CreateInstance(Object serviceProvider, Boolean withEncoding, String moniker)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.EditorFactorySql.CreateEditorInstance(IServiceProvider serviceProvider, Boolean storeActiveConnIfNeeded, String moniker)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.EditorFactoryBase.Microsoft.VisualStudio.Shell.Interop.IVsEditorFactory.CreateEditorInstance(UInt32 createFlags, String moniker, String physicalView, IVsHierarchy hierarchy, UInt32 itemId, IntPtr existingDocData, IntPtr& docViewIntPtr, IntPtr& docDataIntPtr, String& caption, Guid& cmdUIGuid, Int32& result)
       在 System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, IVsProject projectToAddScriptTo, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String rootName)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, IVsExternalFilesManager extFileMgr, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String rootName)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, UIConnectionGroupInfo connectionInfoList, IDbConnection liveCon, String fileRoot)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptFactory.CreateNewScript(String strFullPathToScript, UIConnectionInfo ci, IDbConnection liveCon)
       在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NewQueryMenuHandler.Invoke()
       在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItemBase.MenuInvokedHandler(Object sender, EventArgs args)

    • 已編輯 coercor 2018年10月24日 上午 07:09
    2018年10月24日 上午 06:49

解答

  • 那应该是系统层面的一些文件损坏或者注册表导致的

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • 已提議為解答 Teige GaoModerator 2018年10月31日 上午 06:45
    • 已標示為解答 coercor 2018年11月6日 上午 02:15
    2018年10月30日 上午 08:17
    版主

所有回覆

  • How did you run query in ssms?
    2018年10月24日 下午 05:01
  • 我安装了sql server 2017 但不知道引起这个错误的原因
    2018年10月25日 上午 02:17
  • Hi coercor,

    尝试修复一下VS Shell,另外,你的机器上安装了Visual Studio了吗?

    Best Regards,

    Teige


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2018年10月25日 上午 08:20
    版主
  • 装了  各种修复,重装没有效果 最后重装系统解决的
    2018年10月29日 上午 03:04
  • 那应该是系统层面的一些文件损坏或者注册表导致的

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • 已提議為解答 Teige GaoModerator 2018年10月31日 上午 06:45
    • 已標示為解答 coercor 2018年11月6日 上午 02:15
    2018年10月30日 上午 08:17
    版主