Roslyn: Build error

Created on 6 Jun 2016  路  4Comments  路  Source: dotnet/roslyn

Version Used: Last Commit accepted fb9324de, 06-Jun-16

Steps to Reproduce:

  1. Pull the latest code
  2. Open developer command line and run: Restore.cmd
  3. Run command: msbuild /v:m /m Roslyn.sln

Expected Behavior: No build error.

Actual Behavior: Here's the build output. Notice the mscorlib unable to load exception.

Microsoft (R) Build Engine version 14.0.25123.0
Copyright (C) Microsoft Corporation. All rights reserved.

  CommonCoreClrRuntime -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Core
  Clr\CommonCoreClrRuntime_DoNotUse.dll
  CodeAnalysis -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Microsoft.Co
  deAnalysis.dll
  CSharpErrorFactsGenerator -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug
  \CompilerGeneratorTools\CSharpErrorFactsGenerator.exe
  CompilersBoundTreeGenerator -> C:\Users\Key\Desktop\share\roslyn\Binaries\Deb
  ug\CompilerGeneratorTools\BoundTreeGenerator.exe
  CSharpSyntaxGenerator -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Com
  pilerGeneratorTools\CSharpSyntaxGenerator.exe
  VisualBasicErrorFactsGenerator -> C:\Users\Key\Desktop\share\roslyn\Binaries\
  Debug\CompilerGeneratorTools\VBErrorFactsGenerator.exe
  Microsoft.DiaSymReader.PortablePdb -> C:\Users\Key\Desktop\share\roslyn\Binar
  ies\Debug\Microsoft.DiaSymReader.PortablePdb.dll
  VisualBasicSyntaxGenerator -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debu
  g\CompilerGeneratorTools\VBSyntaxGenerator.exe
  CompilerTestResources -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Ros
  lyn.Compilers.Test.Resources.dll
  PdbUtilities -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Roslyn.Test.
  PdbUtilities.dll
  RunTests -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\RunTests\RunTest
  s.exe
  Scripting -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Microsoft.CodeA
  nalysis.Scripting.dll
  Workspaces -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Microsoft.Code
  Analysis.Workspaces.dll
  DeployCompilerGeneratorToolsRuntime -> C:\Users\Key\Desktop\share\roslyn\Bina
  ries\Debug\CompilerGeneratorTools\DeployCompilerGeneratorToolsRuntime_DoNotUs
  e.exe

  Unhandled Exception: System.IO.FileLoadException: Could not load file or asse
  mbly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7
  798e'. The native image could not be loaded, because it was generated for use
   by a different version of the runtime. (Exception from HRESULT: 0x80131059)
  ---> System.Runtime.InteropServices.COMException: The native image could not
  be loaded, because it was generated for use by a different version of the run
  time. (Exception from HRESULT: 0x80131059)
     --- End of inner exception stack trace ---

  Unhandled Exception: System.IO.FileLoadException: Could not load file or asse
  mbly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7
  798e'. The native image could not be loaded, because it was generated for use
   by a different version of the runtime. (Exception from HRESULT: 0x80131059)
  ---> System.Runtime.InteropServices.COMException: The native image could not
  be loaded, because it was generated for use by a different version of the run
  time. (Exception from HRESULT: 0x80131059)
     --- End of inner exception stack trace ---
  Concord -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Microsoft.CodeAna
  lysis.ExpressionEvaluator.Concord.DoNotUse.dll
  ResultProvider.Portable -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\M
  icrosoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.dll
  ExpressionCompiler -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Micros
  oft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler.dll

  Unhandled Exception: System.IO.FileLoadException: Could not load file or asse
  mbly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7
  798e'. The native image could not be loaded, because it was generated for use
   by a different version of the runtime. (Exception from HRESULT: 0x80131059)
  ---> System.Runtime.InteropServices.COMException: The native image could not
  be loaded, because it was generated for use by a different version of the run
  time. (Exception from HRESULT: 0x80131059)
     --- End of inner exception stack trace ---
  ResultProvider.NetFX20 -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Ne
  tFX20\Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.dll

  Unhandled Exception: System.IO.FileLoadException: Could not load file or asse
  mbly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7
  798e'. The native image could not be loaded, because it was generated for use
   by a different version of the runtime. (Exception from HRESULT: 0x80131059)
  ---> System.Runtime.InteropServices.COMException: The native image could not
  be loaded, because it was generated for use by a different version of the run
  time. (Exception from HRESULT: 0x80131059)
     --- End of inner exception stack trace ---
C:\Users\Key\Desktop\share\roslyn\build\Targets\GenerateCompilerInternals.targe
ts(64,5): error MSB3073: The command ""C:\Users\Key\Desktop\share\roslyn\Binari
es\Debug\CompilerGeneratorTools\CoreRun.exe" "C:\Users\Key\Desktop\share\roslyn
\Binaries\Debug\CompilerGeneratorTools\VBSyntaxGenerator.exe" "Syntax\Syntax.xm
l" "C:\Users\Key\Desktop\share\roslyn\Binaries\Obj\BasicCodeAnalysis\Debug\Synt
ax.xml.Generated.vb"" exited with code -532462766. [C:\Users\Key\Desktop\share\
roslyn\src\Compilers\VisualBasic\Portable\BasicCodeAnalysis.vbproj]
C:\Users\Key\Desktop\share\roslyn\build\Targets\GenerateCompilerInternals.targe
ts(64,5): error MSB3073: The command ""C:\Users\Key\Desktop\share\roslyn\Binari
es\Debug\CompilerGeneratorTools\CoreRun.exe" "C:\Users\Key\Desktop\share\roslyn
\Binaries\Debug\CompilerGeneratorTools\CSharpSyntaxGenerator.exe" "Syntax\Synta
x.xml" "C:\Users\Key\Desktop\share\roslyn\Binaries\Obj\CSharpCodeAnalysis\Debug
\Syntax.xml.Generated.cs"" exited with code -532462766. [C:\Users\Key\Desktop\s
hare\roslyn\src\Compilers\CSharp\Portable\CSharpCodeAnalysis.csproj]
  InteractiveWindow -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Microso
  ft.VisualStudio.InteractiveWindow.dll
  Microsoft.DiaSymReader.PortablePdb.UnitTests -> C:\Users\Key\Desktop\share\ro
  slyn\Binaries\Debug\Microsoft.DiaSymReader.PortablePdb.UnitTests.dll
  CommonNetCoreReferences -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\C
  oreClrTest\CommonNetCoreReferences_DoNotUse.dll
C:\Users\Key\Desktop\share\roslyn\build\Targets\GenerateCompilerInternals.targe
ts(93,5): error MSB3073: The command ""C:\Users\Key\Desktop\share\roslyn\Binari
es\Debug\CompilerGeneratorTools\CoreRun.exe" "C:\Users\Key\Desktop\share\roslyn
\Binaries\Debug\CompilerGeneratorTools\VBSyntaxGenerator.exe" "..\..\..\..\..\C
ompilers\VisualBasic\Portable\Syntax\Syntax.xml" "C:\Users\Key\Desktop\share\ro
slyn\Binaries\Obj\BasicResultProvider.Portable\Debug\\Syntax.xml.Generated.vb"
/gettext" exited with code -532462766. [C:\Users\Key\Desktop\share\roslyn\src\E
xpressionEvaluator\VisualBasic\Source\ResultProvider\Portable\BasicResultProvid
er.Portable.vbproj]
  CSharpResultProvider.Portable -> C:\Users\Key\Desktop\share\roslyn\Binaries\D
  ebug\Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider.dll
  ProcessWatchdog -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\ProcessWa
  tchdog\ProcessWatchdog.exe
  TextEditorFeatures -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Micros
  oft.CodeAnalysis.EditorFeatures.Text.dll
  Workspaces.Desktop -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Micros
  oft.CodeAnalysis.Workspaces.Desktop.dll
  Perf.Utilities -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Roslyn.Tes
  t.Performance.Utilities.dll
C:\Users\Key\Desktop\share\roslyn\build\Targets\GenerateCompilerInternals.targe
ts(93,5): error MSB3073: The command ""C:\Users\Key\Desktop\share\roslyn\Binari
es\Debug\CompilerGeneratorTools\CoreRun.exe" "C:\Users\Key\Desktop\share\roslyn
\Binaries\Debug\CompilerGeneratorTools\VBSyntaxGenerator.exe" "..\..\..\..\..\C
ompilers\VisualBasic\Portable\Syntax\Syntax.xml" "C:\Users\Key\Desktop\share\ro
slyn\Binaries\Obj\BasicResultProvider.NetFX20\Debug\\Syntax.xml.Generated.vb" /
gettext" exited with code -532462766. [C:\Users\Key\Desktop\share\roslyn\src\Ex
pressionEvaluator\VisualBasic\Source\ResultProvider\NetFX20\BasicResultProvider
.NetFX20.vbproj]
  Pdb2Xml -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Pdb2Xml.exe
  Features -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Microsoft.CodeAn
  alysis.Features.dll
  MetadataVisualizer -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\mdv.ex
  e
  VisualStudioInteractiveWindow ->
  VisualStudioInteractiveWindow ->
  VisualStudioInteractiveWindow -> C:\Users\Key\Desktop\share\roslyn\Binaries\D
  ebug\Microsoft.VisualStudio.VsInteractiveWindow.dll
  EditorFeatures -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Microsoft.
  CodeAnalysis.EditorFeatures.dll
  InteractiveFeatures -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Micro
  soft.CodeAnalysis.InteractiveFeatures.dll
  InteractiveEditorFeatures -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug
  \Microsoft.CodeAnalysis.InteractiveEditorFeatures.dll
  EditorFeatures.Next -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Micro
  soft.CodeAnalysis.EditorFeatures.Next.dll
  CSharpResultProvider.NetFX20 -> C:\Users\Key\Desktop\share\roslyn\Binaries\De
  bug\NetFX20\Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider.
  dll
  InteractiveHost -> C:\Users\Key\Desktop\share\roslyn\Binaries\Debug\Interacti
  veHost.exe
  Creating VSIX Container...
  VisualStudioInteractiveWindow -> C:\Users\Key\Desktop\share\roslyn\Binaries\D
  ebug\Microsoft.VisualStudio.VsInteractiveWindow.vsix

Most helpful comment

@diryboy No we are all using VS 2015.2 on our end as are our build machines. This doesn't repro on my dev box. I created a fresh VM with just VS 2015.2 + VSSDK and git installed. Build succeeded.

Suggestions:

  1. Run git clean -xdf to clear out any files left in your enlistment (but be careful as this blows away unstaged changes)
  2. Run taskkill /IM vbcsCompiler.exe /F and taskkill /IM msbuild.exe /F to kill these processes and ensure they are not holding on to old dlls.
  3. Delete your nuget cache (located under C:\Users\%USERNAME%.nuget)

If these steps don't help, well need to dig a bit deeper. We shouldn't be able to put you in a state where msbuild can't find mscorlib.

All 4 comments

+1, the master branch merged the previous future branch recently, does that mean we need "VS15"?

@diryboy No we are all using VS 2015.2 on our end as are our build machines. This doesn't repro on my dev box. I created a fresh VM with just VS 2015.2 + VSSDK and git installed. Build succeeded.

Suggestions:

  1. Run git clean -xdf to clear out any files left in your enlistment (but be careful as this blows away unstaged changes)
  2. Run taskkill /IM vbcsCompiler.exe /F and taskkill /IM msbuild.exe /F to kill these processes and ensure they are not holding on to old dlls.
  3. Delete your nuget cache (located under C:\Users\%USERNAME%.nuget)

If these steps don't help, well need to dig a bit deeper. We shouldn't be able to put you in a state where msbuild can't find mscorlib.

git clean -xdf fix it for me. Thanks.

git clean -xdf also worked for me, thanks @jmarolf!

Was this page helpful?
0 / 5 - 0 ratings