5

当我尝试在 Visual Studio 2015 预览版中构建我的默认 JavaScript 项目(BlankApp Apache Cordova)时,出现以下错误。

TypeScript 编译器没有提供用于编译的文件,因此它将跳过编译。

在 Visual Studio 2015 预览版中采取的步骤:

  1. 文件 -> 新建 -> 项目 -> Apache Cordova 应用程序(在 Javascript 模板下)。

  2. 使用 Android Emulator 运行默认项目。

收到以下错误。

警告 2 TypeScript 编译器没有提供用于编译的文件,因此它将跳过编译。C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript\Microsoft.TypeScript.targets 97 5 BlankCordovaApp4

4

6 回答 6

4

这是 CTP3 版本中的一个已知问题。听起来您已经创建了一个基于 JS 的项目,并且没有添加任何 TypeScript 文件,因此当然没有传递给编译器的 .ts(又名 TypeScript)文件。理想情况下,编译器根本不会运行,但警告是无害的,其他一切都应该正常工作。

于 2014-11-16T23:20:36.563 回答
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.

于 2014-11-16T20:34:38.257 回答
2
  • 选项 1:使项目脱机,编辑项目,删除以下行:

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

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

  • 选项 2:更改"AddTypeScriptReferencePath": truefalseWebessentials-Settings.json
于 2017-11-13T17:20:38.197 回答
1

似乎没有可用于编译的类型脚本文件。在脚本文件夹下添加一个空白类型的脚本文件,然后编译,它应该可以工作。

于 2015-02-15T17:49:56.893 回答
0

这个警告让我对 ASP.NET 5 (asp.net core 1) 发疯了。如果您双击警告,您将打开Microsoft.TypeScript.targets文件。删除该行,CompileTypeScript警告消失。我假设这会阻止 TypeScript 正常编译,这对我来说很好,因为我不想要它。

<PropertyGroup>
  <CompileDependsOn>
    CompileTypeScript;  <--- delete this line
    $(CompileDependsOn);
  </CompileDependsOn>
于 2016-01-22T23:16:02.920 回答
-1

我遇到过同样的问题。

我的原因是 nodejs 缺少系统变量。检查您的视觉工作室输出。如果不识别“node”命令,添加系统变量。

计算机->右键->属性->高级系统设置->环境变量

检查用户变量和系统变量下的“路径”

将 nodejs 路径添加到它。即:C:\Program Files (x86)\nodejs

于 2015-06-01T17:53:47.793 回答