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.
You could go to Tools > Options > Text Editor > JavaScript/TypeScript > Project and uncheck the Project Analysis options.
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.
enable": false //... } in our settings. json file to disable TypeScript and JavaScript warnings by setting typescript. validate.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With