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


当前回答

这可能是因为typescript服务器无法找到包含数组所描述的任何文件:

// tsconfig.json
{
  //...
  "include": [
    "./src/"
  ],
}

如果你正在使用VSCode,你可以在编辑器中超级容易地重新启动TS服务器,提示它像这样重新评估文件:

导航到任何.ts或.tsx文件 打开命令面板(CMD + SHIFT + P在mac上) 执行TypeScript: Restart TS server命令:

其他回答

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

我在这个项目中根本不使用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路径之前添加一个./:

"include": ["./src/**/*.d.ts", "./src/**/*.js", "./src/**/*.svelte"]

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

你需要有两个文件夹,一个用于源代码(typescript),另一个用于输出(javascript)。

tsconfig.json:

{
  "compilerOptions": {
...
    "outDir": "out/", 
    "rootDir": "src/", 
...