【问题标题】:Error starting Visual Studio 2012启动 Visual Studio 2012 时出错
【发布时间】:2018-01-20 00:31:57
【问题描述】:

每次启动 Visual Studio 时都会收到一条错误消息。由于我还在我的项目中看到了一些无法解释的行为,我想解决这个问题。

错误信息

遇到异常。这可能是由扩展引起的。

您可以通过检查文件“C:\Users\Jonathan\AppData\Roaming\Microsoft\VisualStudio\11.0\ActivityLog.xml”来获取更多信息。

当我查看日志文件时,我发现了两个异常:

错误 1

Exception Type       : System.Windows.Markup.XamlParseException
Exception Message    : Provide value on 'System.Windows.StaticResourceExtension' threw an exception.
Exception Stack Trace:
    at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
    at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
    at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
    at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
    at SquaredInfinity.VSCommands.UI.Views.DefaultAlertView.InitializeComponent()
    at SquaredInfinity.VSCommands.Foundation.Services.VSCUIService.GetDefaultAlertViewModel(String alertMessage, String alertDialogTitle)
    at SquaredInfinity.Foundation.Presentation.Services.UIService.GetDefaultAlertViewModel(String alertMessage)
    at SquaredInfinity.Foundation.Presentation.Services.UIService.ShowAlert(String message)
    at SquaredInfinity.VSCommands.VSCommandsPackage.Initialize()
Exception Data   : [EmptyOrNull]
Inner Exception:
Exception Type       : System.Exception
Exception Message    : Cannot find resource named 'VSC.Button'. Resource names are case sensitive.
Exception Stack Trace:    at System.Windows.StaticResourceExtension.ProvideValueInternal(IServiceProvider serviceProvider, Boolean allowDeferredReference)
                      at System.Windows.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider)
                      at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider)
Exception Data   : [EmptyOrNull]

错误 2

System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) The current type,    SquaredInfinity.Foundation.Configuration.Services.IConfigurationService, is an interface and cannot be constructed. Are you missing a type mapping?
Resulting in: Resolution of the dependency failed, type = "SquaredInfinity.Foundation.Configuration.Services.IConfigurationService", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The current type, SquaredInfinity.Foundation.Configuration.Services.IConfigurationService, is an interface and cannot be constructed. Are you missing a type mapping?
-----------------------------------------------
At the time of the exception, the container was:
  Resolving SquaredInfinity.Foundation.Configuration.Services.IConfigurationService,(none)

Resulting in: An exception occurred while trying to create an instance of type '#Btb.#Rtb'.

Resulting in: Cannot activate part '#Btb.#Rtb'.
Element: #Btb.#Rtb -->  #Btb.#Rtb

Resulting in: Cannot get export '#Btb.#Rtb (ContractName="Microsoft.VisualStudio.Text.Classification.IClassifierProvider")' from part '#Btb.#Rtb'.
Element: #Btb.#Rtb (ContractName="Microsoft.VisualStudio.Text.Classification.IClassifierProvider") -->  #Btb.#Rtb

   at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportedValue(CatalogPart part, ExportDefinition export, Boolean isSharedPart)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
   at System.ComponentModel.Composition.Primitives.Export.get_Value()
   at System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export export)
   at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedLazyOfTM>b__1()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InvokeMatchingFactories[TExtensionInstance,TExtensionFactory,TMetadataView](IEnumerable`1 lazyFactories, Func`2 getter, IContentType dataContentType, Object errorSource)

我如何解释这个以便找出错误?

【问题讨论】:

    标签: visual-studio visual-studio-2012


    【解决方案1】:

    VSCommands 扩展或其他插件似乎有问题。您可以尝试禁用所有扩展,重新启动 Visual Studio 并重新启用它们;有时它可以解决此类问题。

    您可以尝试的另一件事是以管理员身份运行 Visual Studio,因为如果没有足够的权限来访问某些资源(这是旧版本 Visual Studio 中的错误),可能会发生此错误。

    您最后的痛苦手段将是干净的重新安装。

    【讨论】:

    • 您知道是否有一种简单的方法可以禁用所有扩展程序吗?
    • 我知道的唯一方法是在扩展管理器(工具->扩展和更新)中一一禁用它们。此外,重新安装扩展可能是一种解决方案,并且比安装 VS 更痛苦
    • 啊,好建议。我禁用的第一个(如您所建议的 Visual Studio 2012 的 VSCommands)停止了错误。该死,有人会认为他们可以提供比这更好的错误报告!
    • 嗨,VSCommands 和其他一些扩展(如 EF Power Tools Beta 2)之间存在兼容性问题,它们已在最新版本中得到修复。
    • 哇,我刚刚遇到了这个问题(在安装更新 4 之后)并通过禁用 Visual Assist X 解决了它。注意:通过 VASSISTX 菜单禁用 VAX 是不够的。使用上面提到的对话框(工具->扩展和更新)。
    【解决方案2】:

    只需在 2013 年 5 月 5 日重新安装最新的 Web Essentials。它解决了这个问题。无需卸载或禁用任何东西,只需再次运行安装程序即可完成。

    http://visualstudiogallery.msdn.microsoft.com/07d54d12-7133-4e15-becb-6f451ea3bea6

    【讨论】:

      【解决方案3】:

      通过删除以下文件夹修复:

      C:\Users{用户名}\AppData\Local\Microsoft\VisualStudio{版本号}\ComponentModelCache

      【讨论】:

        【解决方案4】:

        此错误在安装 Visual Studio 2012 Update 2 后开始。显然 Web Tools 和 Web Essentials 2012 扩展存在冲突——它们都尝试注册一些相同的组件,从而产生此异常。

        此外,安装 VS 2012 Update 2 时,这些扩展中的一个或两个的自动更新通知似乎被破坏了,因为虽然扩展已更新以解决冲突,但您不会收到更新存在的通知。

        解决方案是删除这两个扩展,然后重新安装。

        有关这方面的更多信息,请参阅http://madskristensen.net/post/web-tools-20122-and-web-essentials

        【讨论】:

        • +1 我在更改 BuildSolution 的键盘快捷键后遇到了同样的问题。禁用 Web Essentials 2012 - 同样的问题。卸载的 Web Essentials - 问题消失了。重新安装 Web Essentials - 一切都好! :)
        【解决方案5】:

        我遇到了同样的错误。我注意到 NuGet 包管理器扩展有一个更新。安装此更新后,错误消失了。

        确保应用了所有可用的更新。要检查是否有可用的更新,请打开工具 > 扩展和更新。在“扩展和更新”对话框中,展开左侧窗格中的“更新”节点。安装任何可用的更新并重新启动 Visual Studio 2012。

        【讨论】:

        • 这对我有用。我更新的扩展正是 Nuget 包管理器。
        【解决方案6】:

        对于所有遇到此问题的人:

        1. 打开 Visual Studio 2012,但不要加载任何解决方案/项目
        2. 工具菜单打开扩展和更新
        3. 禁用 Web Essentials 2012
        4. 为您的解决方案删除 .suo 文件
        5. 在 Visual Studio 中打开解决方案
        6. 看到它加载并且 Visual Studio 没有崩溃
        7. 启用 Web Essentials 2012
        8. 重新启动 Visual Studio 2012 并重新加载您的解决方案。
        9. 快乐时光!

        Source

        【讨论】:

          【解决方案7】:

          您只需删除项目和 Visual Studio 的 *.suo 文件即可解决上述问题。我有同样的问题。

          【讨论】:

          • 谢谢!为我工作。
          【解决方案8】:

          我也遇到了同样的错误:

          遇到异常。这可能是由扩展引起的。

          您可以通过检查文件 'C:\Users\ 来获取更多信息。 . . \VisualStudio\11.0\ActivityLog.xml'

          原因:

          我已经从控制面板卸载了一些 SQL 文件。在那之后我才开始收到这个错误,但我不确定我卸载了哪个服务。

          解决办法:

          我下载了SDK for Visual Studio 2012 并安装/重新启动了 Visual Studio,然后它工作正常。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2012-08-28
            • 1970-01-01
            • 1970-01-01
            • 2013-12-27
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多