Aspnet core build pipeline in vscode, especially typescript – in 2020

huangapple go评论79阅读模式
英文:

Aspnet core build pipeline in vscode, especially typescript - in 2020

问题

I'm trying to add Typescript to my VS Code ASP.NET Core MVC application for its wwwroot client scripts. The tutorials I've found talk about full Visual Studio's way of compiling-on-save, but VS Code doesn't do that. I've been in the node stack for a while, and used ASP.NET back before VS Code and folder-based projects.

How is the build pipeline managed/augmented? How can I add a typescript compilation step to it? And btw, how are client-side's packages supposed to be managed? nuget?

I guess I could treat the client scripts as a separate project's bundled output and use yet another script to build both the typescript and the asp.net project in series, but I don't want to have to do all that if the csproj's build can handle it.

英文:

I'm trying to add Typescript to my VS Code ASP.NET Core MVC application for its wwwroot client scripts. The tutorials I've found talk about full Visual Studio's way of compiling-on-save, but VS Code doesn't do that. I've been in the node stack for a while, and used ASP.NET back before VS Code and folder-based projects.

How is the build pipeline managed/augmented? How can I add a typescript compilation step to it? And btw, how are client-side's packages supposed to be managed? nuget?

I guess I could treat the client scripts as a separate project's bundled output and use yet another script to build both the typescript and the asp.net project in series, but I don't want to have to do all that if the csproj's build can handle it.

答案1

得分: 1

如果您正在使用Angular或React,并且从.NET项目中开始是一种不错的选择:https://learn.microsoft.com/en-us/aspnet/core/client-side/spa/angular?view=aspnetcore-5.0&tabs=visual-studio

否则,您将需要手动设置所有部分:

  1. 安装Node.js包管理器

  2. 使用Node包安装TypeScript:

    npm install -g typescript

  3. 按照以下步骤设置编译和调试:

    https://code.visualstudio.com/docs/typescript/typescript-compiling

    https://code.visualstudio.com/docs/typescript/typescript-debugging

还请参考:
https://code.visualstudio.com/Docs/languages/typescript
https://code.visualstudio.com/docs/typescript/typescript-tutorial

英文:

If you are using angular or react starting from one of the dot net projects would be the way to go: https://learn.microsoft.com/en-us/aspnet/core/client-side/spa/angular?view=aspnetcore-5.0&tabs=visual-studio

Otherwise you will need to setup all the parts manually:

  1. Install Node.js Package Manager

  2. Install typescript with node package:

    npm install -g typescript

  3. Follow steps to setup compile and debug in:

    https://code.visualstudio.com/docs/typescript/typescript-compiling

    and

    https://code.visualstudio.com/docs/typescript/typescript-debugging

Also see:
https://code.visualstudio.com/Docs/languages/typescript
https://code.visualstudio.com/docs/typescript/typescript-tutorial

huangapple
  • 本文由 发表于 2020年1月3日 22:53:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/59580671.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定