简体   繁体   English

如何使用Visual Studio 2015创建TypeScript项目

[英]How do I create a TypeScript project with Visual Studio 2015

I'm trying to create a typescript project. 我正在尝试创建一个打字稿项目。

Very simply I want my ts files to turn into js files when I build. 很简单,我希望在构建时将ts文件转换为js文件。

I'm using VisualStudio 2015 Enterprise. 我正在使用VisualStudio 2015企业版。

I created a Blank WebApplication. 我创建了一个空白WebApplication。

I tried to install Typescript but it says typescript 1.6.3 has already been preinstalled. 我尝试安装Typescript,但是它说Typescript 1.6.3已经被预装。

When I create a ts file nothing happens. 当我创建一个ts文件时,什么也没有发生。

When I right-click the project I do not have a Typescript tab in Project properties. 右键单击项目时,项目属性中没有“打字稿”选项卡。

Where am I going wrong? 我要去哪里错了?

Make sure you create a TypeScript web project instead of a blank web project in the new project dialog: 确保在新项目对话框中创建TypeScript Web项目而不是空白Web项目:

在此处输入图片说明

When you build the project, VS will compile your ts files into js files. 当您构建项目时,VS会将ts文件编译为js文件。 But you won't see them unless you turn on 'show all files' in the solution explorer: 但是除非在解决方案资源管理器中打开“显示所有文件”,否则您将看不到它们:

在此处输入图片说明

That should be all you have to do. 那应该就是你要做的。 You can configure advanced properties of the build by right clicking on the project file and selecting project properties: 您可以通过右键单击项目文件并选择项目属性来配置构建的高级属性:

在此处输入图片说明

Hope that's enough to get you started. 希望这足以让您入门。

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

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