我有一个ASP。NET核心项目,我得到这个错误时,我试图构建它:

error TS18003: Build:No inputs were found in config file 'Z:/Projects/client/ZV/src/ZV/Scripts/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '["../wwwroot/app","node_modules/*"]'.
1>         The command exited with code 1.
1>       Done executing task "VsTsc" -- FAILED.

这是我的tsconfig。json文件:

{
  "compileOnSave": true,
  "compilerOptions": {
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es5", "dom" ],
    "module": "commonjs",
    "moduleResolution": "node",
    "noEmitOnError": true,
    "noImplicitAny": false,
    "outDir": "../wwwroot/app/",
    "removeComments": false,
    "sourceMap": true,
    "target": "es6"
  },
  "exclude": [
    "../wwwroot/app",
    "node_modules/*"
  ]
}

这是bug还是我做错了什么?我最近把Visual Studio 2015升级到3。有人以前遇到过这种情况吗?


当前回答

好的,在2021年,有一个<project>/src/index。Ts文件,以下对我有用:

如果VS Code抱怨在配置文件中没有发现输入…然后将include更改为…

“包括”:["。/ src / * * / * .ts”)

在《如何用Typescript编写Node.js应用程序》中找到了上面的注释

其他回答

我必须将文件项添加到tsconfig中。Json文件,如下所示:

{
    "compilerOptions": {
        "target": "es5",
        "module": "commonjs",
        "sourceMap": true,
    },
    "files": [
        "../MyFile.ts"
    ] 
}

更多详情请访问:https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

顺便说一下,我也遇到了同样的问题。

如果你有我的案例,那么你可能有tsconfig。Json和.ts文件不在同一个目录下。

(就我而言,我愚蠢地选择了next。Json和任务。在.vscode文件夹中添加。

好的,在2021年,有一个<project>/src/index。Ts文件,以下对我有用:

如果VS Code抱怨在配置文件中没有发现输入…然后将include更改为…

“包括”:["。/ src / * * / * .ts”)

在《如何用Typescript编写Node.js应用程序》中找到了上面的注释

你需要有根索引。TSX或指数。Ts文件使TSC命令工作。

在'include'标签中添加.ts文件位置,然后编译工作正常。前女友。

"include": [
"wwwroot/**/*" ]