如何在.Net Core项目中禁用TypeScript编译? [英] How to disable TypeScript compilation in .Net Core projects?
问题描述
我有一个Visual Studio 2015 ASP.Net Core项目,其中包含一个打字稿文件文件夹。
I have a Visual Studio 2015 ASP.Net Core project that contains a folder of typescript files.
我的问题是如何防止VS尝试编译TypeScript文件?我不希望它们在保存或构建时进行编译。
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.
我尝试在下面添加项目设置,但似乎没有任何影响。 / p>
I have tried added the project setting below, but it doesn't seem to have any impact.
<PropertyGroup>
<TypeScriptCompileOnSaveEnabled>False</TypeScriptCompileOnSaveEnabled>
</PropertyGroup>
当前VS抛出错误, tsc.exe退出,代码为1
,但是如上所述,我根本不希望TS编译器运行。
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.
我可以禁用typescript。VS使用的目标,
I can disable the typescript.targets that VS uses, but that's not practical, because I need it for other projects.
推荐答案
我花了一些时间在<$ c $中进行挖掘。 c> C:\Program Files(x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets 文件,我找到了一个支持属性
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>
编辑: @Chopin在评论中指出,官方文档针对此和其他与TypeScript MSBuild相关的选项是此处
@Chopin pointed out in the comments that the official doc for this and other Typescript MSBuild related options is here.
这篇关于如何在.Net Core项目中禁用TypeScript编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!