启动Visual Studio 2012时出错

Jon*_*ood 27 visual-studio visual-studio-2012

每次启动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]
Run Code Online (Sandbox Code Playgroud)

错误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)
Run Code Online (Sandbox Code Playgroud)

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

iTe*_*ech 21

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

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

您最后一次痛苦的度假胜地将是一次干净的重新安装.

  • 我知道的唯一方法是在扩展管理器中逐个禁用它们(工具 - >扩展和更新).此外,重新安装扩展可能是一个解决方案,并且比安装VS更少痛苦 (2认同)
  • 嗨,VSCommands和其他一些扩展(如EF Power Tools Beta 2)之间存在兼容性问题,并且它们已在最新版本中修复. (2认同)

enk*_*nko 13

只需重新安装最新的Web Essentials 5/5/2013.它解决了这个问题.无需卸载或禁用任何内容,只需再次运行安装程序即可完成.

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


kar*_*rai 9

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

C:\用户{用户名} \应用程序数据\本地\微软\ VisualStudio的{版本号}\ComponentModelCache