Visual Studio 2017 cannot find typescript compiler?

Viewed 5883

I am trying to build an application in Visual Studio that uses typescript. I followed the directions here and installed the typescript compiler for the version the project requires (2.2). I did it with NPM

npm install typescript 

I verified my installation by

tsc --version

and it returned

Version 2.2.2

which is expected. However, when I go to build my solution I keep getting the following error:

Your project specifies TypeScriptToolsVersion 2.2, but a matching compiler was not found. The latest available TypeScript compiler will be used (2.3). To remove this warning, install the TypeScript 2.2 SDK or update the value of TypeScriptToolsVersion.

I have tried Google-ing and haven't had any luck. Can someone point me down the road to a solution?

1 Answers

Are you on an older version of Visual Studio 2017? Make sure you are on version 15.3.

15.2 includes TypeScript 2.2, but 15.3 also allows different versions of TypeScript to be selected per project.

Once you have updated, you should be able to go to Properties/TypeScript Build for your project and ensure 2.2 is selected.

For future TypeScript updates you can install the TypeScript SDK for Visual Studio 2017.

Check https://github.com/Microsoft/TypeScript/wiki/Updating-TypeScript-in-Visual-Studio-2017 for details. (The instructions you referred to are for Visual Studio Code.)

Related