Visual Studio 2015与C#项目崩溃

时间:2015-05-04 14:13:16

标签: visual-studio-2015

当我打开现有的C#项目或创建一个新的C#项目时,我的visual studio 2015 RC崩溃了。如果我创建或打开一个C ++项目,它不会崩溃。

这是堆栈:

Application: devenv.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name "Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.MiscellaneousFilesWorkspace" but found 0 after applying applicable constraints.
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T](String contractName)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T]()
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]()
   at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[T]()
   at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage`2.Initialize()
   at Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage.Initialize()
Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action`1<System.Exception>)
   at Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage.Initialize()
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(Microsoft.VisualStudio.Composition.ImportDefinition)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.String, Microsoft.VisualStudio.Composition.ImportCardinality)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.String)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.String)
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]()
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]()
   at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetService[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]()
   at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage`2[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Initialize()
   at Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage.Initialize()
   at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider)

1 个答案:

答案 0 :(得分:5)

我在VS 2015 Enterprise RC和RTM上遇到过这个问题。我注意到VS 2015 RTM显示了重复的项目模板(例如,C#控制台应用程序列出了两次)。

我认为在安装VS 2015 RTM之前运行的VS 2015 RC的卸载例程在我的机器上留下了导致问题的一些东西。

这就是我在机器上修复问题的方法(测试系统,而不是我的日常生产开发者机器(!)):

  • 创建系统还原点
  • 卸载VS 2015 RC
  • 手动删除文件夹:C:\ Program Files(x86)\ Microsoft Visual Studio 14.0
  • 手动删除文件夹:C:\ Users \\ AppData \ Local \ Microsoft \ VisualStudio \ 14.0
  • 手动删除文件夹:C:\ Users \\ AppData \ Roaming \ Microsoft \ VisualStudio \ 14.0
  • 重新启动
  • 重新安装VS 2015 RTM(显示一些问题)
  • 修复VS 2015 RTM

现在一切似乎都按预期工作了。