I attended quite some conferences in the first 6 months of 2024. When I get the chance, and there is an SSDT (SQL Server Data Tools) session on the schedule, I go to the session to learn something new. Lately, at Data Saturday Croatia, I had the chance to attend an advanced session about SSDT Templates delivered by Torsten Strauß (LinkedIn).
During this session, he explained how to create templates for your database development. Since I was busy creating my setup for Database Unit Testing, it caught my attention to do the same for my Database Unit Testing Database Project.
Recipe Overview
Preparation time: < 5 minutes
Ingredients
- Existing Database Project in SSDT
- Visual Studio
Creating an SSDT Project Template
Since I was introducing Unit Testing for databases at work, and we have multiple Database Projects, I wanted to do the initial work once and reuse it in my different Database Unit Testing Projects.
To create an SSDT template based on an existing Database Project, you first open the Database Project in Visual Studio. As soon as your Database Project is loaded, navigate to the Project section in the menu bar at the top left. Choose Export Template to continue.
Now, we need to choose the Template Type we want to create. Since we are creating a full project template, we choose to create a Project template. As a next step, we choose the Database Project which we want to create the template for. In my case my Unit Testing Database Project.
As a final step, we define the details such as the Template name, a description, icon images we want to use and finally, we confirm by clicking the Finish button.
Using your own SSDT Project Template
Now that we have created an SSDT project template, we can use it in Visual Studio.
Open Visual Studio and choose Create a new project. Now use the search bar and type in the exact name of your project template.
Enjoy!
Bon appétit!