禁用MSBuild TypeScript编译 [英] Disable MSBuild TypeScript Compile
问题描述
对于Visual Studio项目(例如ASP.NET MVC5),如何在生成/调试时禁用TypeScript文件的编译?
For a Visual Studio projects such as a ASP.NET MVC5, how do you disable compiling of TypeScript files on build/debug?
我目前将tsconfig.json
,compileOnSave
和buildOnSave
设置为false.是否需要在项目.csproj
中添加一些内容以确保其未编译?
I currently have tsconfig.json
compileOnSave
and buildOnSave
set to false. Does something need to be added to the projects .csproj
to ensure it isn't compiled?
调试ASP.NET MVC5项目时,它将编译所有.ts
文件.
When debugging the ASP.NET MVC5 project, it compiles all .ts
files.
感谢您提供的任何帮助.
Thank you for any help you can provide.
推荐答案
将属性<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
添加到csproj文件中的PropertyGroup中(我将其添加到配置"标签下).这应该禁用所有基于msbuild的TS编译.
Add the property <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
to a PropertyGroup in your csproj file (I added it under the Configuration label). This should disable all msbuild based TS compilation.
启用此设置后,您不需要tsconfig.json设置compileOnSave/buildOnSave.
With this setting enabled you shouldn't need the tsconfig.json settings compileOnSave/buildOnSave.
如果您使用的是旧版Visual Studio(我曾隐式考虑过VS 2017或xproj with 2015),则该属性可能为<TypeScriptEnabled>false</TypeScriptEnabled>
.
If you are on an older version of Visual Studio (I had implicitly thought about VS 2017 or xproj with 2015), the property may be <TypeScriptEnabled>false</TypeScriptEnabled>
.
这篇关于禁用MSBuild TypeScript编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!