如何从 Visual Studio 项目中删除 Typescript 支持?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23690009/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove Typescript support from Visual Studio project?
提问by Mike Trusov
Adding TypeScript support in latest version of VS is easy - just add a TypeScript file and VS will automatically will reconfigure the project.
在最新版本的 VS 中添加 TypeScript 支持很容易 - 只需添加一个 TypeScript 文件,VS 将自动重新配置项目。
However when all TS files are gone it spits out this warning:
但是,当所有 TS 文件都消失时,它会发出以下警告:
Warning: The TypeScript Compiler was given no files for compilation, so it will skip compiling.
It is possible to manually remove TypeScript support by editing the project file in notepad, but is there a GUI in VS that handles this?
可以通过在记事本中编辑项目文件来手动删除 TypeScript 支持,但是 VS 中是否有处理此问题的 GUI?
回答by doekman
I removed TypeScript by hand.
我手动删除了 TypeScript。
- Right-click on the Web-project file in the Solution Explorer and choose
Unload project
- Right-click again on the project file, and now choose
Edit {project-name}.csproj
- Remove all elements with the name
TypeScript
in it, and save the XML file - Right-click the project file, and choose
Reload project
- 右键单击解决方案资源管理器中的 Web 项目文件并选择
Unload project
- 再次右键单击项目文件,然后选择
Edit {project-name}.csproj
- 删除其中包含名称的所有元素
TypeScript
,并保存 XML 文件 - 右键单击项目文件,然后选择
Reload project
Always keep a backup of the project file, as you may wreck it. Your millage may vary...
始终保留项目文件的备份,因为您可能会破坏它。您的磨合率可能会有所不同...
回答by Ryan Cavanaugh
There isn't UI for this.
没有用户界面。
回答by NicoD
In the .csproj file commenting the entire line with Microsoft.TypeScript.targets is enough to disable the build.
在 .csproj 文件中用 Microsoft.TypeScript.targets 注释整行足以禁用构建。
回答by Ashutosh Singh
Another approach is to use TypeScriptCompileBlocked tag under PropertyGroup tag of csproject file.
另一种方法是在 csproject 文件的 PropertyGroup 标签下使用 TypeScriptCompileBlocked 标签。
Yes in order to edit the csproj you need to open it in notepad or any other editor. This property is not editable through visual studio.
是的,为了编辑 csproj,您需要在记事本或任何其他编辑器中打开它。此属性无法通过 Visual Studio 进行编辑。
<PropertyGroup>
<TypeScriptCompileBlocked>True</TypeScriptCompileBlocked>
</PropertyGroup>
This wont require you to remove any other typescript tag.
这不需要您删除任何其他打字稿标签。