如何在.Net Core 2项目的VSTS构建服务器上编译Typescript文件 [英] How to compile Typescript files on VSTS build server for .Net Core 2 projects

查看:72
本文介绍了如何在.Net Core 2项目的VSTS构建服务器上编译Typescript文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直试图在VSTS上的CI构建过程中将TypeScript文件编译为JavaScript文件.一旦生成了JavaScript文件,我的gulp文件进程就可以将它们处理到wwwroot文件夹中. 通过在更改时编译文件,然后在检测到的更改上运行gulp文件的Task Runner运行VS来遵循tsconfig.json文件,该项目可以在Visual Studio 2017中很好地构建.在Visual Studio中本地构建或发布时,会生成所有正确的文件.

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.

当尝试将VSTS中的构建过程设置为CI/CD过程的一部分时,将使用"dotnet.exe build"命令构建C#代码,该命令似乎无法编译TypeScript文件.

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.

我如何让.Net Core 2项目同时构建在VSTS中编译和构建的C#和TypeScript文件?

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

推荐答案

默认情况下,dotnet build命令不会编译TypeScript文件.您可以安装 Microsoft.TypeScript.MSBuild 软件包,然后将通过dotnet build命令来编译TypeScript文件.

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.

另一方面,您也可以调用 tsc 命令来编译TypeScript文件.

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

这篇关于如何在.Net Core 2项目的VSTS构建服务器上编译Typescript文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆