我有一个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。有人以前遇到过这种情况吗?


当前回答

我的解决方案中有4个现有项目的现有tsconfig文件。升级到vs2017后,我遇到了这个问题。正如NicoJuicy所描述的那样,通过向文件添加包含和排除部分(假设是默认的)来修复。

其他回答

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

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

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

我得到这个错误:

在配置文件“tsconfig.json”中没有发现输入。

包括指定的路径是 '["**/*"]' 和排除路径”(“* * / * .spec.ts”、“app_ / * * / * .ts”、“* * / * .d.ts”、“node_modules”)”。

我有一个.tsconfig文件,它从。/src文件夹读取TS文件。

这里的问题是,源文件夹不包含任何.ts文件,我正在运行tslint。我通过从gulp文件中删除tslint任务来解决这个问题,因为我没有任何.ts文件需要编译和检测。

我的VSCode在我的tsconfig开始时给了我一条弯曲的线。Json文件,有同样的错误,所以

我确保在“包括”路径中指定的文件夹中至少有一个.ts文件(包括路径中的一个文件夹是空的,这是正常的) 我只是关闭VSCode并重新打开它,这就解决了问题。(唉. .)

我的文件夹结构

    tsconfig.json
    package.json
    bar/
         myfile.ts
    lib/
         (no file)

我tsconfig.json

   "compilerOptions": { ... },
   "include": [
    "bar/**/*",
    "lib/**/*"
   ],
   "exclude": [
    ".webpack/**/*",
    ".vscode/**/*"
   ]
   

对于遇到相同错误的任何人,都应该尝试将“node modules”添加到排除选项中

{
   "compilerOptions": {
     ...
   },
   "include": [
      "./src/**/*.ts"
   ],
   "exclude": [
      "./out.d.ts",
      "node_modules",
   ]
}

我用了这个 如何在。net核心项目中禁用TypeScript编译?

因为我使用模板,而那些包只需要我的模板。 然而,我可以在它们的node_module文件中看到每个包的导出。 如果你有同样的情况,你可以使用上面的链接