【问题标题】:VS 2015 suddenly builds very slowlyVS 2015 突然构建非常缓慢
【发布时间】:2017-04-18 15:31:11
【问题描述】:

我不确定我做了什么,但是 VS 2015 Update 3 曾经在 18 秒内完全重建 13 个 C# 项目,而现在大约需要 143 秒。除此之外,VS 性能没有变化。重新启动,没有变化。

我注意到的一件事是我以前在任务管理器中看到VBCSCompiler.exe,但现在我只看到csc.exe。然后我运行 msbuild.exe Project.sln /t:Clean,Build,它的构建速度与 Visual Studio 过去一样快 - 即使在构建完成后,任务管理器中也会显示 VBCSCompiler.exe

这是怎么回事?

编辑:大约在这发生的时候,我还安装了 Visual Studio“15”预览版 4(我没有注意这些事件的时间,因为我假设 VS 安装是相互隔离的) -但是 VS 15 在我安装它的第二天就完全崩溃了,现在在启动时崩溃了。我还注意到,当我重新启动 VS 2015 时,它显示“'CSharpVsInteractiveWindowPackage' 包没有正确加载”。 ActivityLog.xml 包含以下错误:

CreateInstance failed for package [CSharpVsInteractiveWindowPackage]Source: 'mscorlib' Description: Could not load file or assembly 'Microsoft.VisualStudio.InteractiveWindow, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.VisualStudio.InteractiveWindow, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

File name: 'Microsoft.VisualStudio.InteractiveWindow, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

   at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)

   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)

   at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)

   at System.Activator.CreateInstance(String assemblyName, String typeName)

   at System.AppDomain.CreateInstance(String assemblyName, String typeName)



WRN: Assembly binding logging is turned OFF.

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.

To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].


【问题讨论】:

  • 请对比不同构建时间的构建日志,看看哪些步骤浪费了时间。
  • 还有 4 天前的快速构建日志吗?那会在哪里?
  • 现在可以正常工作了吗?你现在能重现这个问题吗?
  • 请提供一个可以通过 OneDrive 重现问题的简单演示。
  • 好的。另外,请参见上面的编辑。抱歉,我没有另一台机器可以测试。

标签: .net visual-studio-2015 build msbuild


【解决方案1】:

由于使用 msbuild 命令可以正常工作,我认为它与 VS 2015 本身更相关。

首先,请在 Visual Studio 2015 update3 上安装最新的 KB (KB3165756),这会将您的 Visual Studio 版本升级到版本 14.0.25431.01 Update3。转到工具 -> 扩展和更新并检查此更新,如下所示:

其次,您可以尝试重命名或删除以下文件夹:

•C:\Users\\AppData\Local\Microsoft\VisualStudio\14.0

•C:\Users\\AppData\Roaming\Microsoft\VisualStudio\14.0

【讨论】:

    【解决方案2】:

    问题似乎是由“RC Insider”扩展引起的,该扩展被列为Building Roslyn 的先决条件。在我按照卸载说明进行操作后问题得到解决:

    • 关闭所有VS实例
    • 删除 %LocalAppdata%\Microsoft\VisualStudio\14.0\(注意,这将删除所有扩展,而不仅仅是 Roslyn VSIX)
    • 从开发人员命令提示符处运行 devenv /updateconfiguration

    诊断:在增加构建输出的详细级别(工具 | 选项 | 项目和解决方案 | 构建和运行 | MSBuild 项目构建输出详细程度)后,我能够将我的构建过程与@ColeWu-MSFT 的构建日志。我注意到我的机器有一个不同的编译器:

    1>CoreCompile:
    1>  C:\Users\David\AppData\Local\Microsoft\VisualStudio\14.0\Extensions\slmkqtts.ana\csc.exe /noconfig /unsafe- etc etc etc
    

    这是一个扩展取代了我的编译器的主要暗示(不是 Roslyn 构建指令懒得提及的东西)。此外,他的日志说“使用共享编译”(我怀疑这是 VBCSCompiler.exe 的代码),而我的日志没有。非常感谢你的帮助,科尔!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-28
      • 2019-05-09
      • 2014-03-31
      • 2016-04-14
      • 2018-04-25
      • 2016-01-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多