Create a new TypeScript project in Visual Studio

Visual StudioTypescript

Visual Studio Problem Overview


How do I start writing TypeScript projects in Visual Studio? There's no option for it when I create a new project. I have Visual Studio 2012 installed along with the TypeScript add on

Visual Studio Solutions


Solution 1 - Visual Studio

I just found the solution: Manual installation of the VS-Extension.

In some way, the VS-Extension is not getting installed. You can do it manually. There is a .vsix file located in C:\Program Files (x86)\Microsoft SDKs\TypeScript\0.8.0.0 called TypeScriptLanguageService.vsix. Try to run this file. It should install the TypeScript extension.

If you are running an x86-based system, try to look at C:\Program Files\Microsoft SDKs\TypeScript\0.8.0.0.

Worked for me. Now I can create TypeScript projects and it is listed in the Visual Studio extension list.

Note that the newer versions of TypeScript dropped the folder 0.8.0.0. You may find the .vsix file in C:\Program Files (x86)\Microsoft SDKs\TypeScript.

Solution 2 - Visual Studio

You can add TypeScript files to an existing project using the Add > New Item dialog.

enter image description here

You can also create a project of type HTML Application with TypeScript using the Add > New Project dialog. This project type is under Installed->(Templates)->Visual C#.

enter image description here

If these options are missing from Visual Studio, you should try re-installing the TypeScript Visual Studio plugin.

Solution 3 - Visual Studio

If you use Visual Studio 2017, the template 'HTML Application with TypeScript' has been removed from the templates.

But you can install the extension made by rich-newman on Github: https://github.com/rich-newman/typescript-html-application-vs2017-template

To install it do the following:

  • Go to the 'Add New Project' window
  • At the left go to 'online' in the left tree view
  • Search for 'TypeScript HTML Application Template' enter image description here
  • Install the extension and the template should be available under 'installed --> TypeScript'

Solution 4 - Visual Studio

Followed the other answers but could not locate TypeScriptLanguageService.vsix after installing TypeScriptSetup.0.8.0.msi on Win7 64 w/ VS 2010.

To install on VS 2010, use 7zip to open the above msi and extract "TypeScriptLS.vsix_File", remove the trailing _File, and run as usual.

This gives a new TypeScript project template (but not a file template mysteriously), intellisense, code highlighting, etc.

Solution 5 - Visual Studio

I didn't have the project and ts file templates also, tried reinstalling it(just by running vsix file) that didn't help, so I

  1. uninstalled(from the VS2012 manager) the extension
  2. closed VS2012 and then installed it again and voila- the Project and file template magically appeared. Thank god it worked- I can start playing with the language without having to run transcompilation manually every time.

Solution 6 - Visual Studio

Installing typescript adds a new project type as well as adds a file type for existing projects. After installing typescript, you can try searching "typescript" in the new project window. It shows "HTML Application with TypeScript" to me.

Every .ts file typescript file will add a dependent .js file.

Hope this helps!

Solution 7 - Visual Studio

Old post, new suggestion:

I've spent a few hours on this issue on Win8/VS2012. After multiple install/reinstall (of Typescript plugin v 0.8.3), the one thing that worked, was to run VS2012 in Administrator mode and (re)install Web Essentials 2012. That did the trick for me and I got Typescript as it's own section in Add New Project... (and all the other goodies mentioned above).

What reminded me of the run in admin mode was the process to update documentation (if you want to install documentation locally) where it too had an annoying cryptic error. Running in admin mode was also the answer.

You don't have to run in admin mode all the time, just probably a good practice when updating the IDE itself (new plugins, etc.).

Solution 8 - Visual Studio

For version 0.9.1.1 I was able to make it work following the instructions here: http://typescript.codeplex.com/wikipage?title=Compile-on-Save.

Support for Typescript was just disabled on Web Essentials 2012 3.0: http://vswebessentials.com/changelog

Solution 9 - Visual Studio

Another tip - you need to install Visual Studio for Web. It will not work with just VS for Desktop. Also, you need to install the plugin after VS, so if you installed the plugin first, uninstall it then reinstall.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLordZardeckView Question on Stackoverflow
Solution 1 - Visual StudionikeeeView Answer on Stackoverflow
Solution 2 - Visual StudioFentonView Answer on Stackoverflow
Solution 3 - Visual StudioAlexander CosmanView Answer on Stackoverflow
Solution 4 - Visual StudioNeilView Answer on Stackoverflow
Solution 5 - Visual StudioCapajView Answer on Stackoverflow
Solution 6 - Visual StudioBiranchi PandaView Answer on Stackoverflow
Solution 7 - Visual StudioEdSFView Answer on Stackoverflow
Solution 8 - Visual StudiofraView Answer on Stackoverflow
Solution 9 - Visual StudioRob LourensView Answer on Stackoverflow