可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
I have an ASP.NET core project and I'm getting this error when I try to build it:
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.
This is my tsconfig.json
file:
{ "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/*" ] }
Is this a bug or am I doing something wrong? I did recently upgrade Visual Studio 2015 to update 3. Has anyone encountered this before?
回答1:
Added an empty ts file to the Scripts folder and project did compile.
回答2:
I'm not using TypeScript in this project at all so it's quite frustrating having to deal with this. I fixed this by adding a tsconfig.json and an empty file.ts file to the project root. The tsconfig.json contains this:
{ "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" ] }
回答3:
When using Visual Studio Code, building the project (i.e. pressing Ctrl + Shift + B), moves your .ts file into the .vscode folder (I don't know why it does this), then generates the TS18003 error. What I did was move my .ts file out of the .vscode folder, back into the root folder and build the project again.
The project built successfully!
回答4:
I am getting this error, "No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["/"]' and 'exclude' paths were '["/.spec.ts","app_//.ts","/.d.ts","node_modules"]'."
I have a .tsconfig file, which reads ts files from "./src" folder.
The issue here is with that source folder not containing .ts files and i am running tslint. I resolved issue by removing tslint task from my gulp file. As i don't have any .ts files to be compiled and linted. My issue is resolved by doing this.
回答5:
add .ts file location in 'include' tag then compile work fine. ex.
"include": [ "wwwroot/**/*" ]
回答6:
I had existing tsconfig files for 4 existing projects in my solution. After upgrading to vs2017 I experienced this problem. It was fixed by adding the (supposedly default) include and exclude sections to the files, as described by NicoJuicy.
回答7:
Btw, just had the same problem.
If you had my case, then you probably have the tsconfig.json not in the same directory as the .ts file.
(In my case I stupidly had next to launch.json and tasks.json inside the .vscode folder :P)
回答8:
I added the following in the root ( visual studio )
{ "compilerOptions": { "allowJs": true, "noEmit": true, "module": "system", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "sourceMap": true }, "include": [ "**/*" ], "exclude": [ "assets", "node_modules", "bower_components", "jspm_packages" ], "typeAcquisition": { "enable": true } }