简体   繁体   中英

Microsoft.Build could not load EvaluationContext

While building my code through command line I get the error:

System.TypeLoadException: Could not load type 'Microsoft.Build.Evaluation.Context.EvaluationContext' from assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

I am using Visual Studio 2017 on windows environment.

I have tried

  1. Restarting all instances of Visual Studio
  2. Restarting the machine.
  3. Tried repairing the Visual Studio through Visual Studio Installer.
  4. Tried to uninstall and reinstall Microsoft.Build.Framework.dll using gacutil. I am still getting the same error.

It would be very helpful if I can get a fix for this. Thanks in advance.

Microsoft.Build could not load EvaluationContext

First , check whether you can build the project in VS2017 IDE to make sure the issue is related to MSBuild.exe with you invoke or not.

Besides , use

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe

to build your project with command line. This is the standard msbuild.exe for command line building projects.

Suggestion

1) If these do not work, you could try to reinstall the Microsoft.Build in GAC.

gacutil /u Microsoft.Build

gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Build.dll"

2) check your reference dlls in your project and make sure that they are compatible and accessible.

3) delete bin and obj folder, and then run command to build again.

In addition , you can also share the detailed build error,log, detailed info or provide a small sample of your project with us so that it will help us troubleshoot your issue more quickly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM