简体   繁体   中英

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. 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).

Steps I am taking:

  • Open Visual Studio, File -> New Project
  • ASP.Net Web Application (.Net Framework)
  • Select 'empty' template, add references for MVC
  • Add a new folder called 'Scripts'
  • Add a new ts file called ts1.ts
  • Open ts1.ts and add single line (eg var a = 1 )
  • Save - no JS emitted.
  • Build - no JS emitted.
  • Ask VS really nicely - no JS emitted.

I've tried it with/without tsconfig.json and I have tried adding compileOnSave to tsconfig when I have added it.

Help?

edit: There are no build errors or warnings and I get a message in the footer saying 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.

Spot the idiot.

I had to enable 'view all files' to see the generated JS.

在此处输入图片说明

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