4

I've been trying to get my TypeScript files compiled to JavaScript files in my CI build process on VSTS. Once the JavaScript files have been generated then my gulp file process can process them to the wwwroot folder. The project builds fine in Visual Studio 2017 with VS obeying the tsconfig.json file by compiling the file on change and then the Task Runner running the gulp file on detected changes and build. All the correct files are genereated when building or publishing locally in Visual Studio.

When trying to set up my build process in VSTS as part of my CI/CD process the C# code is built using the "dotnet.exe build" command which does not appear to compile the TypeScript files.

How can I have the .Net Core 2 project build both the C# AND the TypeScript files compiled and built in VSTS?

Peter Caitens
  • 43
  • 1
  • 5

1 Answers1

8

By default, dotnet build command won’t compile TypeScript file. You can install Microsoft.TypeScript.MSBuild package, then the TypeScript file will be compiled through dotnet build command.

On the other hand, you also can call tsc command to compile TypeScript file.

starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
  • Thanks. Will that obey the tsconfig.json file settings or is there another way to set the options for the typescript compiler? – Peter Caitens Jan 16 '18 at 22:55
  • Yes, it will obey the tsconfig.json file in your project. – starian chen-MSFT Jan 17 '18 at 01:19
  • As an addition to this answer: please make sure you use the right version of the package. We're currently using TypeScript 2.5, installing the latest version of the NuGet package (2.7) breaks the build. The NuGet package versions seem to be in line with TypeScript versioning. – rickvdbosch Feb 28 '18 at 09:47