英文:
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
否则,您将需要手动设置所有部分:
-
安装Node.js包管理器
-
使用Node包安装TypeScript:
npm install -g typescript
-
按照以下步骤设置编译和调试:
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:
-
Install Node.js Package Manager
-
Install typescript with node package:
npm install -g typescript
-
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论