简体   繁体   English

IIS上的angular6应用程序部署

[英]angular6 application deployment on IIS

I have an c# .net application as the back-end, and the front-end was in angular 6, i know that when i use ng build --prod to build the angular app, it will generate the required file with hash file name. 我有一个c#.net应用程序作为后端,并且前端位于angular 6中,我知道当我使用ng build --prod生成angular应用程序时,它将生成带有哈希文件名的所需文件。

Now i would like to host the app in IIS. 现在,我想在IIS中托管该应用程序。 But when i have a new build on my angular app, i use ng build --prod to build, the file name was changed, and i have to replace the file in IIS, any ways to let my IIS to get my new build file automatically? 但是,当我在我的角度应用程序上有了新的构建时,我使用ng build --prod进行构建,文件名已更改,并且我必须替换IIS中的文件,以任何方式让IIS来获取我的新构建文件自动吗?

If I understood your right you want a automaticall way to get your new build into your IIS folder and delete the files in there? 如果我理解您的权利,那么您需要一种自动的方法来将新版本放入IIS文件夹并删除其中的文件吗?

The CLI got no way to that automatically. CLI无法自动实现。 You can append a path with the --outpu-path option but that wont clear your old unused files from the IIS folder: 您可以使用--outpu-path选项附加路径,但不会从IIS文件夹中清除旧的未使用文件:

You could try to write some little bat file that deletes the folder in your IIS and moves the files from your build to the IIS folder. 您可以尝试编写一些小bat文件,该文件会删除IIS中的文件夹,并将文件从内部版本移动到IIS文件夹。

SET startFolder="C:\yourpath\to\dist"
SET destinationFolder="\\yourServerOrLocal\pathto\iis"

for %%F in (%destinationFolder%\*.*) do del /s /q /f "%%F" %destinationFolder%

for %%G in (%startFolder%\*.*) do move /Y "%%G" %destinationFolder%
pause

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM