Use specific TypeScript compiler version in Visual Studio

前端 未结 4 564
灰色年华
灰色年华 2020-12-11 00:50

I wonder if there\'s a way to set specific TypeScript compiler version for project in Visual Studio. So I could configure a project to always use version 1.0, even if new ve

4条回答
  •  青春惊慌失措
    2020-12-11 01:03

    If you try to compile a project with 0.9 using TypeScript version 1.0 you'll get the following error:

    Your project file uses a different version of the TypeScript compiler and tools than is currently installed on this machine. No compiler was found at C:\Program Files (x86)\Microsoft SDKs\TypeScript\0.9\tsc.exe. You may be able to fix this problem by changing the element in your project file.

    So it's preventing you from compiling with newer version. It does not however put the compiler into some 0.9 compatibility mode.

    But if you have TypeScript 0.9 installed, it will compile against that version. So yes, you can force a specific version of the TypeScript compiler using the attribute.

    Basically what the do is that it changes the path to the compiler:

    C:\Program Files (x86)\Microsoft SDKs\TypeScript\\tsc.exe
    

提交回复
热议问题