简体   繁体   English

如何确保Visual Studio在构建期间使用哪种TypeScript编译器?

[英]How to ensure exactly which TypeScript compiler Visual Studio is using during build?

Context 上下文

Recently TypeScript compiler (1.8.x) became available as Nuget Package too. 最近,TypeScript编译器(1.8.x)也可以作为Nuget Package使用。 However here is a bit cloudy fact that there are two packages 然而这里有一个有点混乱的事实,有两个包

  • a) Microsoft.TypeScript.Compiler (no dependencies) a)Microsoft.TypeScript.Compiler(无依赖关系)
  • b) Microsoft.TypeScript.MSBuild (**no dependencies but contains TypeScript.Compiler...btw:why?) b)Microsoft.TypeScript.MSBuild(**没有依赖,但包含TypeScript.Compiler ...顺便说一句:为什么?)

In my project (.csproj) TypeScript version was set to 1.7 originally 在我的项目(.csproj)中,TypeScript版本最初设置为1.7

<TypeScriptToolsVersion>1.7</TypeScriptToolsVersion>

I wanted to know what happens after installing a) or b) 我想知道安装a)或b)后会发生什么

Issue/Question 问题/问题

I do not know simple way how to diagnose what is exactly happening during the Visual Studio 2015 build about TypeScript compile. 我不知道如何诊断Visual Studio 2015构建期间关于TypeScript编译的确切情况的简单方法。

  • I do not know how to see any output from tsc.exe (like version number, path, etc) 我不知道如何看到tsc.exe的任何输出(如版本号,路径等)
  • I do not know how to see any resulting (effective) setting from which path the MSBuild task will launch tsc.exe 我不知道如何查看任何结果(有效)设置,MSBuild任务将从哪个路径启动tsc.exe

Diganostic results (optional reading, if anyone is interested) Diganostic结果 (可选阅读,如果有人有兴趣)

Because of my lack of knowledge I had to use Mark Russinovich's ProcessMonitor to make sure what is happening. 由于我缺乏知识,我不得不使用Mark Russinovich的ProcessMonitor来确保发生了什么。 This is the question: How to do this more simple? 这是一个问题:如何做到这一点更简单?

  • Installing a) does nothing except coping a working instance of tsc to your project's /packages folder. 安装a)除了将tsc的工作实例复制到项目的/ packages文件夹之外什么都不做。 The .csproj file was not touched. 没有触及.csproj文件。 Consequently the originally configured MSBuild task will apply to .ts files and original installed tsc 1.7 is running from Program Files 因此,最初配置的MSBuild任务将应用于.ts文件,并且原始安装的tsc 1.7正在从Program Files运行

  • Uninstalling a) Correctly "restores" the original state. 卸载a)正确“恢复”原始状态。 (Well, this is nothing else than deleting the package from the /packages folder (嗯,这只是从/ packages文件夹中删除包

  • Installing b) The same as a) + changes the MSBuild task entry in .csproj. 安装b)a)相同+更改.csproj中的MSBuild任务条目。 As a result the new tsc 1.8 will run from the /package folder. 因此,新的tsc 1.8将从/ package文件夹运行。

  • Uninstalling b) Removes all, including all TypeScript related MSBuild task from the .csproj file. 卸载b)从.csproj文件中删除所有,包括所有与TypeScript相关的MSBuild任务。 This is silently disables all ts file compilation (with no warnings and errors). 这是静默禁用所有ts文件编译(没有警告和错误)。 The simple way to restore the default behaviour is to add a dummy .ts file to your project, which will insert the default MSBuild task back to your .csproj file. 恢复默认行为的简单方法是向项目添加一个虚拟.ts文件,该文件将默认的 MSBuild任务插回到.csproj文件中。

Either install was touched the setting: 安装被触及设置:

<TypeScriptToolsVersion>1.7</TypeScriptToolsVersion> 

Back to the question 回到问题

Is there a simpler way to see what is exactly happening about TypeScript during VS 2015 build, than using ProcessMonitor? 有没有比使用ProcessMonitor更简单的方法来查看VS 2015构建过程中TypeScript的确切情况?

This is probably a little late but if you run msbuild with msbuild /verbosity:Detailed or msbuild /v:Detailed it will give you much more detailed information as to what is going on with the typescript compilers. 这可能有点晚了,但是如果你使用msbuild / verbosity运行msbuild :详细或msbuild / v:详细它会为你提供更详细的信息,说明打字稿编译器发生了什么。

Just search for tsc.exe in the build output and you will see the version of typescript it is using 只需在构建输出中搜索tsc.exe,您将看到它正在使用的typescript版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Visual Studio编译器使用CGO构建库? - How to build a library with cgo using visual studio compiler? 安装编译器时如何确保Visual Studio更新注册表 - How to ensure Visual studio updates the registry when installing compiler 如何使用Visual Studio构建打字稿项目参考 - How to build typescript project references with visual studio 如何使用条件编译器常量在Visual Studio预构建事件中删除目录? - How do I remove directory in Visual Studio pre-build event using conditional compiler constants? 在Visual Studio中使用特定的TypeScript编译器版本 - Use specific TypeScript compiler version in Visual Studio Visual Studio 2017找不到typescript编译器? - Visual Studio 2017 cannot find typescript compiler? Visual Studio 2010中是否有编译器设置可确保编写可移植的C ++? - Are there compiler settings in Visual Studio 2010 to ensure the writing of portable C++? 在Visual Studio全新构建期间如何删除dlldata.c? - How to delete dlldata.c during clean build in Visual Studio? 在Visual Studio加载项中,如何在生成过程中禁用菜单项? - In a Visual Studio Add-In, how to disable menu items during a build? Visual Studio 2012-如何将多个生成操作分配给TypeScript文件 - Visual Studio 2012 - How to assign multiple build actions to a TypeScript file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM