Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable TypeScript compilation in .Net Core projects?

I have a Visual Studio 2015 ASP.Net Core project that contains a folder of typescript files.

My question is how can I prevent VS from trying to compile the TypeScript files? I don't want them compiled, either on save or build.

I have tried added the project setting below, but it doesn't seem to have any impact.

<PropertyGroup>
  <TypeScriptCompileOnSaveEnabled>False</TypeScriptCompileOnSaveEnabled>
</PropertyGroup>

Currently VS is throwing an error, tsc.exe exited with code 1, but as stated, I don't want the TS compiler to run at all.

I can disable the typescript.targets that VS uses, but that's not practical, because I need it for other projects.

like image 994
Joseph Gabriel Avatar asked Aug 27 '16 01:08

Joseph Gabriel


People also ask

How do I disable TypeScript in a Project?

You could go to Tools > Options > Text Editor > JavaScript/TypeScript > Project and uncheck the Project Analysis options.

How do I disable TypeScript?

To disable a TypeScript rule for a specific line, we can use the @ts-ignore comment. to add the // @ts-ignore: Unreachable code error comment so that the TypeScript compiler ignores the unreachable code error in the line after the comment.

How to disable TypeScript in Visual Studio code?

enable": false //... } in our settings. json file to disable TypeScript and JavaScript warnings by setting typescript. validate.


1 Answers

I spent some time digging around in the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets file, and I found a support property that seems to do the job.

Add this property to the project, by editing the project file directly and adding this property group:

<PropertyGroup>   <!-- Makes the TypeScript compilation task a no-op -->   <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> </PropertyGroup> 

EDIT: @Chopin pointed out in the comments that the official doc for this and other Typescript MSBuild related options is here.

like image 112
Joseph Gabriel Avatar answered Sep 19 '22 16:09

Joseph Gabriel