To partition your asp.net core project into several csprojs is easy or maybe you want to make use of one or more common functionality between multiple apps. ASP.Net Core came with an abstraction over the resource of an app, it’s called application parts. Using an appliction part, we can share controllers,views, tag helpers etc into more than one application. It can also be used as a way to structure your asp.net core project into specific projects where the project contains all resource from controllers to views.
How to
For example if you have an ASP .NET Core MVC called demoapplicationpart you can add a new csproj as part of the application and put it in a different projec. Here is the steps to do it:
- Create a separate class library csproj, give it name demoapplication.part1.csproj.
- Install the following nuget packages
- Microsoft.AspNetCore.Mvc.Abstractions
- Microsoft.AspNetCore.Mvc.ViewFeatures
- Open demoapplication.part1.csproj and add all views as an embedded resource.
- Go to Startup.cs in demoapplicationpart.csproj and get the assembly of demoapplication.part1 and add it as application part.
after you done with the above steps, go ahead build and try running your application.