TypeScript 1.3 for Visual Studio 2013 missing SDK directory (tsc.exe)

岁酱吖の 提交于 2019-12-05 22:43:16

问题


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

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

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:

The specified task executable location "C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.3\tsc.exe" is invalid.

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

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

Does anyone know why the 1.3 folder was not included in this release?

NB: Using VS Professional 2013 (12.0.30723.00 Update 3)


回答1:


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).

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 ;-)

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).

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.




回答2:


When I upgraded to TypeScript 1.3 on the tsUnit project, the changeset showed that the tools version changed from:

<TypeScriptToolsVersion>1.0</TypeScriptToolsVersion>

To

<TypeScriptToolsVersion>1.1</TypeScriptToolsVersion>

So the "Tools Version" doesn't match the language version.

  • TypeScript 1.1 -> ToolsVersion 1.0
  • TypeScript 1.3 -> ToolsVersion 1.1

It is worth noting that the language, compiler and tools may all have different versions. Run tsc -v to see the language version, which is Version 1.3.0.0 if you have the latest version (as of November 2014).




回答3:


Does anyone know why the 1.3 folder was not included in this release?

This comment clarifies it : https://github.com/Microsoft/TypeScript/issues/1138#issuecomment-62993605 Quote:

You should have the 1.3 language services with a tools version of 1.1, and the 1.1 folder should contain the 1.3 compiler. I realize this is confusing



来源:https://stackoverflow.com/questions/26898185/typescript-1-3-for-visual-studio-2013-missing-sdk-directory-tsc-exe

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