asp.net mvc – Angular Duplicate index.html When Setting outputPath


I am developing an ASP.Net application in Visual Studio which has several Razor pages under a controller. What I am trying to do is create a path which returns the angular app, but have other paths go to their respective controllers:

  • mysite.com/Home/ <– This should go to HomeController
  • mysite.com/Other/ <– This should go to OtherController
  • mysite.com/Utility/ <– This should go to the Angular application

I figured that an easy way to do this would be to change the output of my angular application files to wwwroot/Utility, so that in order to access those files, you would have to point your browser to mysite.com/Utility which would fetch the appropriate files.

So, added baseHref and modified the outputPath in angular.json:

    "outputPath": "dist/Utility/",
    "baseHref": "/Utility/",

However, despite changing my outputPath in angular.json to “dist/Utility/”, I have a duplicate set of index.html, vendor.js, main.js, etc being placed in the wwwroot when I publish my application.

  1. Why might publishing still be placing duplicate files in my wwwroot in addition to putting them in wwwroot/Utility?
  2. Is there a more elegant way of solving this problem?



Source link

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top