简体   繁体   中英

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.

Now i would like to host the app in 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?

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?

The CLI got no way to that automatically. You can append a path with the --outpu-path option but that wont clear your old unused files from the IIS folder:

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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