Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile Typescript files on VSTS build server for .Net Core 2 projects

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?

like image 712
Peter Caitens Avatar asked Jan 29 '23 20:01

Peter Caitens


1 Answers

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.

like image 61
starian chen-MSFT Avatar answered Jan 31 '23 21:01

starian chen-MSFT