简体   繁体   English

Typescript无法在Visual Studio 2017中保存或发布时进行编译

[英]Typescript not compiling on save or publish in Visual Studio 2017

It seems not matter what I do, I cannot get my .ts files to compile into .js files. 似乎没关系,我无法将.ts文件编译成.js文件。 I have uninstalled and reinstalled Visual Studio 2017 Community and I now have VS 2017 15.2 (26430.15) and Typescript 2.2.2.0 (according to the About window inside VS). 我已经卸载并重新安装了Visual Studio 2017社区,现在拥有VS 2017 15.2 (26430.15)Typescript 2.2.2.0 (根据VS中的About窗口)。

Steps I am taking: 我正在采取的步骤:

  • Open Visual Studio, File -> New Project 打开Visual Studio,文件->新建项目
  • ASP.Net Web Application (.Net Framework) ASP.Net Web应用程序(.Net Framework)
  • Select 'empty' template, add references for MVC 选择“空”模板,为MVC添加引用
  • Add a new folder called 'Scripts' 添加一个名为“脚本”的新文件夹
  • Add a new ts file called ts1.ts 添加一个名为ts1.ts的新ts文件。
  • Open ts1.ts and add single line (eg var a = 1 ) 打开ts1.ts并添加单行(例如var a = 1
  • Save - no JS emitted. 保存-没有JS发出。
  • Build - no JS emitted. 构建-没有JS发出。
  • Ask VS really nicely - no JS emitted. 很好地询问VS-不会发出JS。

I've tried it with/without tsconfig.json and I have tried adding compileOnSave to tsconfig when I have added it. 我已经尝试过使用tsconfig.json或不使用tsconfig.json并且在添加tsconfig时尝试将compileOnSave添加到tsconfig

Help? 救命?

edit: There are no build errors or warnings and I get a message in the footer saying Output(s) generated successfully . 编辑:没有构建错误或警告,并且我在页脚中收到一条消息,指出Output(s) generated successfully

Do you not just need to select "Show All Files" in the Solution Explorer. 您不仅需要在解决方案资源管理器中选择“显示所有文件”。 I have just followed your exact steps, and when showing all files, I can see the JS file, its just not automaticly added to the project. 我已经按照您的确切步骤操作了,在显示所有文件时,我可以看到JS文件,但该文件并未自动添加到项目中。

Spot the idiot. 发现白痴。

I had to enable 'view all files' to see the generated JS. 我必须启用“查看所有文件”才能查看生成的JS。

在此处输入图片说明

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

相关问题 Visual Studio 2017不编译打字稿 - Visual Studio 2017 not compiling typescript Visual Studio 2017 TypeScript无法保存 - Visual Studio 2017 TypeScript fails to save 打字稿在保存时编译会中断Visual Studio 2017中的AngularJS - typescript compile on save breaks AngularJS in Visual Studio 2017 Visual Studio 2017:js 文件导致许多打字稿错误 - Visual Studio 2017: js file causes many typescript errors 使用Visual Studio 2017将Typescript转换为ES5-导出未定义 - Transpiling Typescript to ES5 with Visual Studio 2017 - Exports is Not Defined 如何在Visual Studio中编译带有错误的TypeScript(保存时) - How to Compile TypeScript (on save) With Errors in Visual Studio Typescript-在Visual Studio代码中编译.ts文件时出错 - Typescript - Error while compiling a .ts file in visual studio code Visual Studio 2017 中用于 JavaScript 和 TypeScript 文件的 Visual Studio Code 颜色主题 - Visual Studio Code color theme in Visual Studio 2017 for JavaScript and TypeScript files Visual Studio 2017上的JSLint - JSLint on Visual Studio 2017 如何在 Visual Studio 2017 中使用 Web 应用程序发布独立的 Angular 组件 (njsproj) - How to publish standalone Angular component (njsproj) with web application in Visual Studio 2017
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM