也许这是显而易见的,但我到处检查(除了正确的地方),谷歌它。什么都没有。
当前回答
你可以做npm list | grep typescript,如果它是通过npm安装的。
其他回答
在Visual Studio 2015上,只需访问:help/about Microsoft Visual Studio 然后你会看到这样的东西:
微软Visual Studio企业2015 版本14.0.24720.00更新1 微软。net框架 版本4.6.01055
...
打印稿1.7.6.0 TypeScript for Microsoft Visual Studio
....
在这个问题被提出两年之后,使用Visual Studio命令提示符仍然没有为我提供正确的答案。但通常的帮助|关于窗口似乎工作这些天:
更新(2017年6月):
VS 2013没有显示这个信息。(稍后注意:VS 2017企业版也不显示此信息)。 VS使用Microsoft Build Engine (MSBuild)编译Typescript文件。MSBuild可以支持几个主要的Typescript版本,但是About窗口只显示最新的版本。
下面是深入了解问题的方法:
A.要检查Visual Studio/MSBuild安装了哪些版本的Typescript,请检查C:\Program Files (x86)\Microsoft sdk \ Typescript文件夹的内容。例如,我有1.0、1.8和2.2版本:
B.检查你的项目需要哪个版本的Typescript。在*。在csproj文件中,寻找<TypeScriptToolsVersion>标签,或者如果它没有,你可以添加它,就像这样
< PropertyGroup > ... < TypeScriptToolsVersion > 1。8 < / TypeScriptToolsVersion > ... < / PropertyGroup >
C.最后,你可以检查MSBuild实际使用的Typescript版本。在TOOLS |选项|项目和解决方案|构建和运行中将MSBuild项目输出详细信息设置为详细信息:
然后构建你的项目并检查输出:你应该看到(A)中描述的Typescript文件夹之一的引用。
As far as I understand VS has nothing to do with TS installed by NPM. (You may notice after you install TS using NPM, there is no tsc.exe file). VS targets only tsc.exe installed by TS for VS extension, which installes TS to c:\Program Files (x86)\Microsoft SDKs\TypeScript\X.Y. You may have multiple folders under c:\Program Files (x86)\Microsoft SDKs\TypeScript. Set TypeScriptToolsVersion to the highest version installed. In my case I had folders "1.0", "1.7", "1.8", so I set TypeScriptToolsVersion = 1.8, and if you run tsc - v inside that folder you will get 1.8.3 or something, however, when u run tsc outside that folder, it will use PATH variable pointing to TS version installed by NPM, which is in my case 1.8.10. I believe TS for VS will always be a little behind the latest version of TS you install using NPM. But as far as I understand, VS doesnt know anything about TS installed by NPM, it only targets whateve versions installed by TS for VS extensions, and the version specified in TypeScriptToolsVersion in your project file.
我有VS2015,我必须用TypeScript 1.7运行一个构建,虽然我有1.8安装通过npm install TypeScript -g有两种方法(至少对我来说他们工作):
到你的.proj文件中,尽可能地添加<TypeScriptToolsVersion>1.7</TypeScriptToolsVersion>。重建,重新运行。如果不行,试试2。 进入“控制面板->系统->高级系统设置->环境变量”。确保你先添加了你想要的TypeScript版本:C:\Program Files (x86)\Microsoft sdk \TypeScript\1.7;C:\Users\serban\AppData\Roaming\npm
这也会影响你的CLI:
$ tsc -v
message TS6029: Version 1.7.5
你可以在Visual Studio 2013中的NuGet Package Manager Console中运行它。
推荐文章
- 如何为构造函数定制Visual Studio的私有字段生成快捷方式?
- 从元组/数组值派生联合类型
- 如何在Angular2 ngSwitch语句中使用typescript enum值
- 为什么Visual Studio 2015/2017/2019测试运行器没有发现我的xUnit v2测试
- Visual Studio复制项目
- 找到合成属性@panelState。请在您的应用程序中包含“BrowserAnimationsModule”或“NoopAnimationsModule”。
- Angular 2+和debounce
- 如何在iis7应用程序池中设置。net Framework 4.5版本
- 在TypeScript箭头函数中指定返回类型
- 如何使用jQuery与TypeScript
- Angular 2模板中的标签是什么意思?
- Typescript接口-可能使“一个或另一个”属性要求?
- 如何扩展/继承组件?
- Visual Studio - Resx文件默认“内部”为“公共”
- 在Visual Studio 2010中有快速查找文件的方法吗?