How to create multi project templates in Visual Studio 2017?
Project templates are very useful and helps developers to make initial set up ready. For example, if you are working on a web project which needs other layers like Data, Entity and Service..etc. You may create each of them as a library projects and refer among them as you need. But when you start with another web project you may need to do all this process again. Because Visual Studio by default does not support multi project templates. In this article I am going to explain how to create multi project templates and make them re-usable. In this example I am using .Netcore Web Api project.
Finally all the references should look below.
Now select the first project from the Drop down. i.e., Api Project.
Step #1: Create a .Netcore WebApi Project using Visual Studio. Select the Api project as shown below.
Step #2: Create Data, Entity and Service layers as library projects.
Create Entity and Service layers in the same way. Once you create all the layers the Solution explorer should look like below.
Step #3: Now we need to add references for the projects as we need. First reference service layer project from Api. Then
Data Layer References Entity Layer
Service Layer References Data Layer
Finally all the references should look below.
Step #4: Now make sure that the solution is building successful after adding references. Now we need to export this project to make it template. To do this go to Project->Export Template.
Now select the first project from the Drop down. i.e., Api Project.
Click on Next Button.
Note down the path in the output location and click on finish button.
C:\Users\sampath\Documents\Visual Studio 2017\My Exported Templates
Repeat this process for all the projects. Finally the exported projects should look like this.
Step #5: Follow the steps mentioned in the video.
Download Project
Comments
Post a Comment