Skip to content

Including "Microsoft.TypeScript.MSBuild" in a project breaks Typescript compile on save #27567

@mperdeck

Description

@mperdeck

TypeScript Version: 3.2.0-dev.201xxxxx
Tested, bug still present.

Search Terms:
Microsoft.TypeScript.MSBuild

Descriptions and Steps to reproduce

Including the latest version of the Nuget package "Microsoft.TypeScript.MSBuild" in a project breaks Typescript compile on save. However, it is required to have your Typescript files generated during a dotnet publish.

Reproduced in Visual Studio Professional 2017, Version 15.8.6.

  1. Create new "ASP.NET Core Web Application" project in Visual Studio 2017.
  2. Choose "Web Application (Model-View-Controller). Do not configure for HTTPS.
  3. In the wwwroot directory, create a new .tsx file - click wwwroot directory | add | new item | Web | Typescript JSX file.
  4. The properties of the new file show "Package Action" is "TypeScriptCompile".
  5. Enter some simple TypeScript in the new file, for example "var x: number = 5;". On save, the file is automatically compiled.

  1. Perform a "dotnet publish" on the command line in the root directory of the project. The .tsx does not get compiled as part of the publish.

  1. Add the line "" to an ItemGroup in the .csproj of the project.
  2. The properties of the .tsx file added earlier no longer show a "Package Action".
  3. Edit the .tsx file - it is no longer compiled on save. It is still compiled though when you build the project.

  1. Perform a "dotnet publish" on the command line in the root directory of the project. The .tsx now does get compiled as part of the publish.
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.

Expected behavior:
Including the Microsoft.TypeScript.MSBuild package should not break compile on save.

Actual behavior:
Including the Microsoft.TypeScript.MSBuild package breaks compile on save.

Playground Link:

Related Issues:

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptVisual StudioIntegration with Visual StudioWorking as IntendedThe behavior described is the intended behavior; this is not a bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions