简体   繁体   中英

VS2015 - Change TypeScript Version

I am trying to update my Visual Studio 2015 + Cordova + TypeScript project to use TypeScript version to 1.6.0-beta . I am currently using 1.5.3 .

I am able to use NPM to install the latest version, but my project continues using the old version. npm install -g typescript

How can I make my project use the latest TypeScript version?

Locations of TypeScript Versions:

1.5.3 = C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.5

1.6.0-beta = C:\\Users\\XXX\\AppData\\Roaming\\npm

--------------------- Updated 9/4/2015 --------------------------

I updated the projects .jsproj file XML element <TypeScriptToolsVersion>1.5</TypeScriptToolsVersion> to <TypeScriptToolsVersion>1.6.0-beta</TypeScriptToolsVersion> . I added the folder 1.6.0-beta and NPM files to C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript and VS2015 doesn't use the latest TypeScript. 在此处输入图片说明

Am I missing something?

Here's the solution to upgrading TypeScript in Visual Studios 2015:

Download the TypeScript EXE release from the following website: http://www.microsoft.com/en-us/download/details.aspx?id=48593 在此处输入图片说明

Click the details to view other releases: In this case I want to download 1.6.0 Beta 在此处输入图片说明

Download the exe and install onto computer.

Create a new TypeScript Cordova project in VS2015. VS2015 may ask if you want to upgrade the project to the latest version. Follow the directions as necessary. 在此处输入图片说明

Updating Existing Projects

If you have an existing project that needs to use a specific version to TypeScript, download the TypeScript version using the above steps, and modify the .jsproj file's XML element <TypeScriptToolsVersion>1.6</TypeScriptToolsVersion> . Set the number to the folder name located in C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript folder. The folder name represents the installed TypeScript version.

在此处输入图片说明

You can use <TypeScriptToolsVersion> in the visual studio project file that changes the path to the TypeScript compiler.

So move your C:\\Users\\XXX\\AppData\\Roaming\\npm to C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.6.0-beta\\tsc.exe

Visual Studio 2017 version 15.3<= :

  1. Right click on the project node in Solution Explorer
  2. Click Properties
  3. Go to the TypeScript Build tab
  4. Change TypeScript version to the desired version or "use latest available" to always default to the newest version installed

Visual Studio 2017 version 15.2>= :

  1. From the top menu bar, open Tools > Options > Text Editor > JavaScript/TypeScript > IntelliSense

  2. Change Use TypeScript version to your desired version

I had a problem when updating that the version did not fall through. Fixed it by setting a lower version, shut down Visual Studio and then set the newer version. This fixed the problem.

在此处输入图片说明

https://github.com/Microsoft/TypeScript/wiki/Updating-TypeScript-in-Visual-Studio-2017

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM