Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Define <base href="/ProjectName/"> for Angular Project By Visual Studio Publish?

I have a .Net Core API project that includes an Angular version 7 project, so I do not want to change the index.html source code each time manually,

index.html

<base href="/">

manually each time when I build development version (VS -> href ="/" -> IIS Express ) then build production version by Visual Studio publish (VS-> href="/ProjectName/" -> Right-Click On Project -> Publish...), I believe it does not make sense!

N.B. As I publish and build angular project by VS publish feature I don't access to this commands,

ng build --prod --base-href /ProjectName/ 

or any different type of this command

I am looking for a solution to handle this issue by configuration or something like this.

Thanks a lot!

like image 685
MoeinMP Avatar asked Mar 08 '26 08:03

MoeinMP


1 Answers

Add it to package.json for build script "build":

ng build --prod --aot  --base-href /ProjectName/
like image 96
savinn Avatar answered Mar 09 '26 22:03

savinn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!