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


当前回答

当使用Visual Studio Code构建项目时(即按Ctrl + Shift + B),将.ts文件移动到.vscode文件夹中(我不知道为什么它这样做),然后生成TS18003错误。 我所做的就是将我的.ts文件从.vscode文件夹中移出,回到根文件夹中,并再次构建项目。

项目构建成功!

其他回答

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

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

我在这个项目中根本不使用TypeScript,所以处理这个非常令人沮丧。我通过添加tsconfig来解决这个问题。Json和一个空文件。Ts文件到项目根目录。tsconfig。Json包含以下内容:

{
  "compilerOptions": {

    "allowJs": false,
    "noEmit": true // Do not compile the JS (or TS) files in this project on build

  },
  "compileOnSave": false,
  "exclude": [ "src", "wwwroot" ],
  "include": [ "file.ts" ]
}

我犯了同样的错误,因为我有这个:

"include": [ 
    "wwwroot/ts/*.ts" 
  ],
  "exclude": [ 
    "node_modules",
    "wwwroot"
  ]

出现错误是因为文件夹wwwroot出现在include和exclude中,您应该退出其中一个。

当我在同一目录下对node_modules文件夹进行备份时,我收到了同样的错误。当发生这种情况时,我正在尝试解决一个不同的构建错误。我希望这个场景能帮助到一些人。删除备份文件夹,构建将完成。

如果你正在使用vs代码进行编辑,那么尝试重新启动编辑器。这个场景解决了我的问题。我认为这是编辑器缓存的问题。