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


当前回答

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

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

其他回答

我在这个项目中根本不使用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" ]
}

在通过Visual Studio 2019将我的项目打包成块时,我经常遇到这个问题。在寻找了很长时间的解决方案之后,我似乎已经按照本文中的建议解决了这个问题

MSBuild & Typescript

特别是关于<TypeScriptCompile />的部分,其中我使用Include操作符包括了所有的.ts资源,并使用Remove操作符排除了node_modules等其他资源。然后我删除了tsconfig。Json文件在每个违规项目和nuget包生成和没有更多的错误

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

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

您还可以尝试重新启动代码编辑器。这也很有效。

如果你正在使用VSCode,并且你打开了几个文件夹,那么你需要打开你正在工作的一个文件夹,让它消失。

错误打开文件夹 文件夹右打开