Visual Studio 2019 无法识别 tsconfig.json [英] Visual Studio 2019 does not recognize tsconfig.json

查看:116
本文介绍了Visual Studio 2019 无法识别 tsconfig.json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了 Visual Studio 2019 并使用我当前的解决方案进行了尝试.它似乎忽略了 tsconfig.json 文件,而它在 VS 2017 中工作.在 Visual Studio 2017 中的项目属性:TypeScript Build,它显示:

I just installed Visual Studio 2019 and tried it with my current solution. It seems like it ignores the tsconfig.json file, while it worked in VS 2017. In Visual Studio 2017 in project properties: TypeScript Build, it shows:

检测到一个或多个 tsconfig.json 或 jsconfig.json 文件.项目属性被禁用.

One or more tsconfig.json or jsconfig.json files detected. Project properties are disabled.

这很好用,并根据我的 tsconfig.json 文件编译文件.

This works good and compiles the files according to my tsconfig.json file.

现在新安装的 Visual Studio 2019 的行为有所不同.它没有显示那句话,我必须在项目属性中配置所有设置.它似乎根本无法识别我的 tsconfig.json 文件.

Now the newly installed Visual Studio 2019 behaves differently. It does not show that sentence and I have to configure all the settings in the project properties. It seems like it does not recognize my tsconfig.json file at all.

如何让 VS 2019 使用 tsconfig.json 而不是项目属性?

How do I get VS 2019 to use the tsconfig.json instead of the project properties?

推荐答案

tsconfig.json 文件的 Build Action 属性 (F4) 必须设置为 Content.否则,自 VS 2019 起,Visual Studio 将忽略此文件.

The Build Action property (F4) for the tsconfig.json file has to be set to Content. Otherwise Visual Studio ignores this file since VS 2019.

虽然有一个缺点:在此更改后 VS 2017 会抱怨构建操作:

There is a downside though: After this change VS 2017 will complain about the Build Action:

错误NETSDK1022

Error NETSDK1022

包含重复的内容"项目..NET SDK 包括默认情况下,项目目录中的内容"项.你可以从您的项目文件中删除这些项目,或设置如果您想将EnableDefaultContentItems"属性设置为false"明确地将它们包含在您的项目文件中.想要查询更多的信息,请参阅 https://aka.ms/sdkimplicititems.重复的项目是:'tsconfig.json'

Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultContentItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'tsconfig.json'

这篇关于Visual Studio 2019 无法识别 tsconfig.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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