The TypeScript Compiler was given no files for compilation, so it will skip compiling

房东的猫 提交于 2019-11-27 18:42:44

问题


When i am trying to Build my default JavaScript project(BlankApp Apache Cordova) in Visual Studio 2015 preview am getting following error.

The TypeScript Compiler was given no files for compilation, so it will skip compiling.

Steps Taken in visual studio 2015 preview:

  1. File -> New -> Project -> Apache Cordova apps(under Javascript templates).

  2. Run the default project with Android Emulator.

Getting the following error.

Warning 2 The TypeScript Compiler was given no files for compilation, so it will skip compiling. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript\Microsoft.TypeScript.targets 97 5 BlankCordovaApp4


回答1:


This is a known issue in the CTP3 release. It sounds like you've created a JS-based project, and have not added any TypeScript files, and so of course there are no .ts (aka TypeScript) files passed to the compiler. Ideally the compiler wouldn't be run at all, but the warning is harmless, and everything else should otherwise be working.




回答2:


You need to make sure that at least one of your TypeScript files is marked with the TypeScriptCompile build action.

If you click on the file and check the properties window in Visual Studio you will see the build action - it may be that they are all set to some other action.




回答3:


  • Option 1: Take Project offline, edit project, remove the following lines:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')"/>

and

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />

  • Option 2: Change "AddTypeScriptReferencePath": true to false in Webessentials-Settings.json



回答4:


It seems that there is no type script file available to compile. add a blank type script file under script folder and then compile, it should work.




回答5:


This warning was driving me nuts with ASP.NET 5 (asp.net core 1). If you double click the warning you open the Microsoft.TypeScript.targets file. Delete the line with CompileTypeScript and the warning goes away. I'm assuming this prevents TypeScript from compiling normally, which is fine by me as I don't want it anyway.

<PropertyGroup>
  <CompileDependsOn>
    CompileTypeScript;  <--- delete this line
    $(CompileDependsOn);
  </CompileDependsOn>



回答6:


I had the same issue.

Mine was due to missing system variable to nodejs. Check your visual studio output. If it is not recognizing “node” command, add system variable.

Computer->right click-> properties -> advanced system settings -> Environment Variable

Check “path” under user variables and system variables

Add the nodejs path to it. Ie: C:\Program Files (x86)\nodejs



来源:https://stackoverflow.com/questions/26945921/the-typescript-compiler-was-given-no-files-for-compilation-so-it-will-skip-comp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!