Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
744 views
in Technique[技术] by (71.8m points)

visual studio 2015 - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I spent some time digging around in the C:Program Files (x86)MSBuildMicrosoftVisualStudiov14.0TypeScriptMicrosoft.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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...