如何抑制VS2017中的虚假Typescript编译错误? [英] How can I suppress spurious Typescript compilation errors in VS2017?

查看:408
本文介绍了如何抑制VS2017中的虚假Typescript编译错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个.Net项目,其中包含一些嵌入式资源,这些资源是带有自定义文件扩展名的xml文件.

We have a .Net project with some embedded resources that are xml files with a custom filename extension.

由于某种原因,在我的计算机上,Visual Studio突然(最近几天)决定将它们视为TypeScript文件,并且在每个版本上都会产生数以万计的编译错误.

For some reason, on my computer, Visual Studio has suddenly (for the last few days) decided to treat these as TypeScript files and is producing tens of thousands of compile errors on each build.

错误不会停止构建,但是会减慢构建速度,使我难以确定真正的错误.

The errors don't stop the build, but they do slow it down and make it hard to work out what the real errors are when I have them.

到目前为止,我已经尝试添加

So far I've tried adding

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>

到我的csproj文件,我已经查看了Javascript的保存时编译"设置,并且未启用它.这些修补程序似乎都不起作用.

to my csproj files, and I've looked at the "Compile on Save" setting for Javascript and it is not enabled. Neither of these fixes seem to work.

我们的项目中根本没有任何TypeScript.

We don't have any TypeScript in our project at all.

我正在运行Visual Studio 2017 15.5.7

I'm running Visual Studio 2017 15.5.7

我们团队中没有其他人报告此问题.

Nobody else in my team is reporting this issue.

推荐答案

经过一些试验,我发现了如何在自己的情况下禁止显示这些消息.

After some experimenting, I discovered how to suppress these messages in my circumstances.

在某个时候,我已经将文件扩展名注册为要在VS中使用XML编辑器进行编辑的文件类型.这是通过以下方式完成的: 工具,选项,文本编辑器,文件扩展名

At some point, I had registered a file extension as a type of file to be edited in VS with the XML editor. This is done via: Tools, Options, Text Editor, File Extension

我已将文件扩展名添加为应使用XML编辑器进行编辑的扩展名,如下所示:

I had added my file extension as an extension that should be edited with the XML editor like below:

删除关联后,编译错误停止出现.

After I removed the association, the compile errors stopped appearing.

我不知道是什么原因导致Visual Studio 2017决定应在XML编辑器中打开的文件应视为TypeScript文件并进行编译.但是,添加扩展名的原因不再适用,所以我很高兴将其删除.

I don't know what caused Visual Studio 2017 to decide that files to be opened in the XML editor should be treated as TypeScript files and compiled. However, the reason I added the extension no longer applies, so I happily removed it.

这篇关于如何抑制VS2017中的虚假Typescript编译错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆