本文介绍了用于 Visual Studio 2013 的 TypeScript 1.3 缺少 SDK 目录 (tsc.exe)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Typescript v1.3 已今天发布,所以我安装了 VS2013 的强力工具更新.

Typescript v1.3 was announced today, so I installed the power tools update for VS2013.

安装后我可以看到 Visual Studio 现在知道protected"关键字和元组类型,这很棒!

After installation I can see that Visual Studio now knows about "protected" keyword and tuple types, which is great!

但后来我将 *.csproj 文件中的 TypeScriptToolsVersion 属性从 1.1 更改为 1.3:

But then I changed the TypeScriptToolsVersion attribute in my *.csproj file from 1.1 to 1.3:

<TypeScriptToolsVersion>1.3</TypeScriptToolsVersion>

这样做后,我在构建时收到以下错误:

After doing this, I get the following error when building:

指定的任务可执行位置C:\Program Files(x86)\Microsoft SDKs\TypeScript\1.3\tsc.exe"是无效.

安装程序尚未创建文件夹1.3".

The folder "1.3" has not been created by the installer.

作为一种解决方法,我只需复制 1.1 编译器就可以让它工作.

As a workaround, I've been able to get it work by just making a copy of the 1.1 compiler.

有谁知道为什么 1.3 文件夹没有包含在这个版本中?

注意:使用 VS Professional 2013(12.0.30723.00 更新 3)

NB: Using VS Professional 2013 (12.0.30723.00 Update 3)

推荐答案

当前 1.3 版本安装到 1.1 文件夹中,新项目将设置 项目文件中的属性也设置为1.1"(因为该元素的值是我们附加到C:\Program Files (x86)\Microsoft SDKs\TypeScript"以查找编译器的值,因此这需要同步).

The current 1.3 release installs into the 1.1 folder, and new projects will set the <TypeScriptToolsVersion> property in the project file to "1.1" also (as the value from this element is what we append to "C:\Program Files (x86)\Microsoft SDKs\TypeScript" to look for the compiler, so this needs to be in sync).

对于编译器,我们可以并排有多个版本(从 1.0 和 1.1 文件夹中可以看出),因此将使用与项目中 TypeScriptToolsVersion 设置相对应的编译器版本来构建项目.我们不会自动将目标版本向前移动(以便与不像你们一样前沿的大学进行项目往返;-)

For the compiler we can have multiple versions side-by-side (as can be seen with 1.0 and 1.1 folders), so the compiler version corresponding to the TypeScriptToolsVersion setting in the project will be used to build the project. We don't automatically move the targeted version forward (in order to enable round-tripping the project with colleges who aren't as cutting edge as you guys ;-)

对于 Visual Studio 中的语言服务,只能存在一个版本,即安装的最新版本.由于我们的目标是保持向后兼容性,因此这不应该影响打开旧项目版本时的体验(除了更宽容地使用旧编译器在编译时会失败的新功能).

For the language service in Visual Studio however only one version can be present, which will be the latest version installed. As we aim to maintain backwards compatibility, this shouldn't impact the experience when opening older project versions (other than being more permissive of new features that will fail at compile time with the older compiler).

当您打开具有较早版本的项目时,我们会发出警告,指出项目版本与语言服务不同步,这可能会发生(类似于您的项目文件使用较旧版本的 TypeScript 编译器和此版本 Visual Studio 不支持的工具.您的项目可能正在使用 TypeScript 语言功能,在使用此版本的 TypeScript 工具进行编译时会导致错误").这是一个无害的警告,您可以继续编辑项目.如果您确实通过指定的编译器版本不支持的语言服务添加新功能,则构建时将发生错误(根据警告).

We do warn when you open a project with an earlier version specified that the project version is out of sync with the language service and this may occur (something like "Your project file uses an older version of the TypeScript compiler and tools than supported by this version of Visual Studio. Your project may be using TypeScript language features that will result in errors when compiling with this version of the TypeScript tools"). This is a harmless warning and you can continue to edit the project. If you do add new features via the language service not supported by the compiler version specified, an error will occur at build time (as per the warning).

这并不理想,我们正在讨论如何改进它.如有任何混淆,敬请原谅.

It's not ideal and we're discussing how we can make this better. Sorry for any confusion.

这篇关于用于 Visual Studio 2013 的 TypeScript 1.3 缺少 SDK 目录 (tsc.exe)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 10:13