How to Resolve the 'Error MSB6006 tsc.exe exited with code 2' build error in Visual Studio 2015
After long pause I returned back to my pet project, but suddenly build started to fail with error Error MSB6006 tsc.exe exited with code 2
.
The error is quite ambiguous. Answers on stack overflow didn’t help much.
But I was able to find what was the issue. I needed more details: what was the exact issue why TypeScript compiler failed?
To find out that I changed build verbosity to detailed:
In Visual Studio, open Tools->Options
, there go to Projects and Solutions->Build and Run
, and select Detailed in the MSBuild project build output verbosity
:
Run the build again and open output tab. Then it is just a matter of finding the place with detailed error message and addressing it.
There may be multiple reasons why build fails. In my case detailed error was:
1> Task "VsTsc"
1> C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe --project "C:\Users\vitalii\Source\Repos\BenchmarkLab\src\BenchmarkLab\wwwroot\lib\hydrolysis\tsconfig.json"
1> Unknown output: Cannot open file 'C:\Users\vitalii\Source\Repos\BenchmarkLab\src\BenchmarkLab\wwwroot\lib\hydrolysis\typings\main.d.ts'.
1> C:\Users\vitalii\Source\Repos\BenchmarkLab\src\BenchmarkLab\error TS6053:Build:File 'C:/Users/vitalii/Source/Repos/BenchmarkLab/src/BenchmarkLab/wwwroot/lib/hydrolysis/typings/main.d.ts' not found.
1> 1>
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(214,5): error MSB6006: "tsc.exe" exited with code 2.
1> Done executing task "VsTsc" -- FAILED.