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


当前回答

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

其他回答

我把所有的.ts文件都放在src文件夹中,它是tsconfig.json的兄弟文件夹。当我的include看起来像这样时,我得到了这个错误(它之前是工作的,一些依赖升级导致错误显示):

"include": [
    "src/**/*"
],

改成这样就解决了我的问题:

"include": [
    "**/*"
],

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

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

我的文件夹结构

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

我tsconfig.json

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

对我来说,解决方案是将文件夹传递到本地磁盘,在我将文件夹复制到谷歌驱动器存储库(g:/)。当拷贝回来的时候,所有工作都很好。

当您创建tsconfig。Json文件的TSC——init,然后注释输入和输出文件目录。这就是错误的根本原因。

要解决这个问题,取消注释这两行:

"outDir": "./", 
"rootDir": "./", 

在取消注释后,它最初看起来像上图。

但是我所有的。ts脚本都在src文件夹中。我指定了/src。

"outDir": "./scripts", 
"rootDir": "./src", 

请注意,您需要在rootDir中指定.ts脚本的位置。

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

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