从 Visual Studio 2017 部署 Angular 2 应用程序 [英] Deploying an Angular 2 application from Visual Studio 2017

查看:27
本文介绍了从 Visual Studio 2017 部署 Angular 2 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Visual Studio 2017 并开发了两个 Angular 2 应用程序.第一个是没有后端代码的纯 Angular 2(数据来自 wcf 服务).第二个是托管在 MVC 应用程序 (.net 4.6) 中的 Angular 2 SPA 应用程序.它们都工作得很好,我可以在 VS2017 中运行和编辑它们而没有问题.部署到 IIS 服务器时会出现问题.目前,我正在使用 gulp 将 node_modules 目录中的组件捆绑到 .js 文件中.然后,我手动将应用程序的所有文件(包括 gulp 捆绑文件)复制到服务器.这是一个费力的过程,我想找到更好的方法.我希望 Visual Studio 能够提供模板来创建上述两种类型的 angular 2 应用程序,并发布功能以捆绑应用程序,包括单击按钮时所需的 node_module 组件,但我很失望.尽可能接近此功能的最佳选择是什么?请帮忙.

I use Visual Studio 2017 and have developed two Angular 2 applications. The first is pure Angular 2 with no backend code (Data comes from wcf services). The second is an Angular 2 SPA application hosted in an MVC application (.net 4.6). They both work great and I can run and edit them in VS2017 with no issues. The problem comes with deploying to an IIS server. At the moment, I am bundling the components from the node_modules directory into .js files using gulp. I am then manually copying all the files for the application (including the gulp bundled files) to a server. This is a laborious process and I would like to find a better way. I was hoping Visual Studio would have provided templates to create the two type of angular 2 applications described above and also publish functionality to bundle the app including the necessary node_module components at the click of a button but have been disappointed. What is my best option to get as close to this functionality as possible? Please help.

推荐答案

感谢大家的好建议.通过遵循我在这里找到的优秀文章,我设法实现了这一点:http://candordeveloper.com/2017/04/12/how-to-use-angular-cli-with-visual-studio-2017/

Thanks to everyone for the great suggestions. I've managed to achieve this by following the excellent article I found here: http://candordeveloper.com/2017/04/12/how-to-use-angular-cli-with-visual-studio-2017/

这篇文章非常直截了当,而且效果很好.希望这对其他人也有帮助.

This article made it pretty straight-forward and it is working well. Hopefully this helps others as well.

这篇关于从 Visual Studio 2017 部署 Angular 2 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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