Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build error MSB600 "tsc.exe" exited with code 2

Can anyone give any insight. Couldn't find any information about this. -Asp.net 5 project- Visual studio 2015 Encountered the below error

Error MSB6006 "tsc.exe" exited with code 2. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets 213

EDIT: This is line 213 of the Microsoft.TypeScript.targets file

  <VsTsc
  ToolPath="$(TscToolPath)"
  ToolExe="$(TscToolExe)"
  TSConfigFile="%(ConfigFiles.Identity)"
  YieldDuringToolExecution="$(TscYieldDuringToolExecution)"
  ProjectDir="$(ProjectDir)"
  ToolsVersion="$(TypeScriptToolsVersion)"
  TypeScriptCompileBlocked="$(TypeScriptCompileBlocked)"
  ComputeOutputOnly="false">

I have succeded to compile with gulp-typescript library.

[16:27:47] Starting 'build-ts'... Process terminated with code 0.

[16:27:50] TypeScript: 4 semantic errors.

[16:27:50] TypeScript: emit succeeded (with errors)

[16:27:50] Finished 'build-ts' after 3.49 s

like image 258
Dživo Jelić Avatar asked Mar 26 '16 12:03

Dživo Jelić


4 Answers

There may be multiple reasons behind this error. The problem is VS does not show exact error returned by TypeScript compiler.

I wrote a blog post that explains small trick to get detailed error message, I hope it will be useful for someone: http://the-coderok.azurewebsites.net/2016/07/13/Resolve-the-Error-MSB6006-tsc-exe-exited-with-code-2-build-error-in-Visual-Studio-2015/

like image 138
vmg Avatar answered Oct 23 '22 02:10

vmg


If you are having problems with ASP.NET Core xproj compilation and don't have any .ts file, you could disable Typescript compilation modifying .xproj file and adding:

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>

Inside the first

<PropertyGroup>
    <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
    ...
</PropertyGroup> 
like image 32
Paco Ferre Avatar answered Oct 23 '22 02:10

Paco Ferre


After updating TypescriptToolsVersion to 1.8

 <TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>

Change Typescript Targets paths to include TypeScriptionVersion location. like below.

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\$(TypeScriptToolsVersion)\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\$(TypeScriptToolsVersion)\Microsoft.TypeScript.targets')" />
like image 6
Gopi Avatar answered Oct 23 '22 00:10

Gopi


Changing my tsconfig.json fixed that for me. it looks like:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "sourceMap": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "outDir": "wwwroot/app/",
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  },
  "filesGlob": [
    "node_modules/**",
    "wwwroot/**/*",
    "typings/**/*"
  ],
  "compileOnSave": false
like image 1
Nadav Hury Avatar answered Oct 23 '22 02:10

Nadav Hury