Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS 2015 C++ compilation failed on "CodeTaskFactory load"

I got strange error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(219,5): error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Build.Tasks.Core.dll". Timed out waiting for a program to execute. The command being executed was "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /noconfig /fullpaths @"E:\BuildAgent\temp\buildTmp\dxr3ks1s.cmdline".

I disabled code analysis:

<RunCodeAnalysis>false</RunCodeAnalysis>
<RunCodeAnalysisOnThisProject>false</RunCodeAnalysisOnThisProject>

but I see same error :(

like image 270
kain64b Avatar asked Aug 24 '16 06:08

kain64b


1 Answers

I've faced the same issue when tried to build a project through CMAKE. In my env I have two versions of VS: VS2015 (ver 14) and VS2022 (ver 17). The VS2022 build successful, but not the VS2015. I have to say everything was ok before I installed WDK (or maybe the regular windows update broke my build environment).

I've spent a few days to find a solution: reinstalling and installing all the SDKs, WDK and VS. Nothing helped. Finally I came up with a solution: replace file VS2015\Microsoft.CodeAnalysis.targets by the file from VS2022\Microsoft.CodeAnalysis.targets

copy C:\work\vs2022\Professional\Msbuild\Microsoft\VisualStudio\v17.0\CodeAnalysis\Microsoft.CodeAnalysis.Targets "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\"Microsoft.CodeAnalysis.Targets  

C:\work\vs2022\ - this is the path where I've installed the VS2022.

Just to save your time I've uploaded the file VS2022\Microsoft.CodeAnalysis.targets to the git, so you can download Microsoft.CodeAnalysis.Targets without installing vs2022.

I hope this will help someone.

like image 61
vadim_hr Avatar answered Oct 23 '22 23:10

vadim_hr