Reputation: 2115
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
Upvotes: 25
Views: 16621
Reputation: 7806
My app would compile fine on my machine, but fail when building in Azure DevOps. I fixed it by changing TypeScriptToolsVersion in my csproj file...
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
Upvotes: 0
Reputation: 3075
My answer was that I had a project that was using TypeScript 2.0 with Visual Studio 2015 that I opened in Visual Studio 2013. Opening it in Visual Studio 2015 fixed the problem for me.
Upvotes: 1
Reputation: 10566
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/
Upvotes: 14
Reputation: 1485
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')" />
Upvotes: 7
Reputation: 4354
I had the same issue, and seeing you fixed yours by your comment on your question by removing the bad tsconfig.json lead me to find the cause of my error too.
I had this line in my tsconfig.json in efforts to get my sourcemap files to work with my browser again.
"sourceRoot": "/"
Removing this line fixed the issue (and hadn't been fixing my sourcemap issue it transpired anyway)
I guess if you're hitting this issue you have a bad tsconfig.json compilerOptions
Upvotes: 0
Reputation: 689
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
Upvotes: 1
Reputation: 311
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>
Upvotes: 12