VS2017 Msbuild Framework Error

Issue
After reinstalling my laptop, My web project that originally normal cannot be deployed.It shows errors Could not load file or assembly "Microsoft.Build.Framework".



Reason
Below image is my currently web.config that contains binding redirect setting which is the newest 14.0.0.0, but it shows error was cannot find 4.0.0.0.
My previous os has installed both of VS2015 and VS2017 then the project upgrade from 4.6.2 to 4.7 so that my judge the reason could be lack of some of the old version dll.

ps:This setting cames from Microsoft Report Viewer 14.


Workaround
1.Modified Microsoft.Build.Framework to 15.1.0.0

2.Updating Global assembly caching
Run as administrator to open Developer Command

Execute the following command.
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Framework.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Engine.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Conversion.Core.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Tasks.Core.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Build.Utilities.Core.dll"

Reference

Popular posts from this blog

VS2017-Build fail-FindDependenciesOfExternallyResolvedReferences

IIS Block IP Setting

VS2017.15.8.4 Error fixed