Question: How do I configure solution with a .NET Core application to use the same controllers, routes, and authentication handled by an ASP.NET application in the same solution?
Background: I have a project that is a single page application built with the ASP.NET Single Page Application template included in VS. The template creates a project using knockout as the SPA library. I am going to greatly expand the codebase of the application and we are going to move it to an Angular project.
I'd like to use the new Angular template
that properly takes advantage of the Angular CLI as well as uses the more lightweight .NET Core. The problem is that I dont know how to take advantage of all the backend codebase currently maintained in the original ASP.NET application from the .NET Core project in the same solution.
I am able to develop the Angular application within the original ASP.NET application by creating a ClientApp directory and building a new Angular CLI application in that directory. I develop using the `ng build --watch` command which outputs static files on every save to a ClientDist directory. I can then serve up the rendered static assets from any given route by adding a few adjustments to my web.confg and calling the following in the associated controller:
public ActionResult Index()
return new FilePathResult("/ClientDist/index.html", "text/html");
The major downside to this approach is:
1) I believe it muddles concerns of the codebase. An Angular CLI application is a very large undertaking that should be seperate from the rest of the backend codebase as much as possible.
2) (the real downside) I cant figure out how to debug my Typescript files in the browser. Normally when you develop an Angular CLI app you can set breakpoints in the compiled code thats then mapped to the original Typescript file. With this model I only have the compiled code. Its doable right now since its a small application, but it'll hamstring us latter.