Friday, August 29, 2014

TFS - Building Database Project - PART I

Visual Studio 2012

Building a Database Project with TFS

I have built DBA data warehouse with TFS Database Project. I documented steps that I need to follow to build a database using TFS database Project. I created this post to share my knowledge with others.

Check and verify that VS 2012 has SQL Server template installed. 



If not, please install SSDTSetup.exe

1. Open VS2012 Studio and Click on New Project


2. Choose SQL server and give database name that you want to create. Check Add to source control





3. A new project is created in Solution explorer and it is added in source control



4. Set Target server by clicking on Properties of solution.




5. Currently, Target platform is SQL server 2014. So, change it to SQL server 2012


6. Save


7. Now, right click on solution and create a folder


8. Name a folder Scripts




9. Next, add a table under Scripts folder


10. Name a table and Click on Add


11. Build a table using a script or GUI


12. Save .  A new table is added to Scripts folder under the solution.

13. Next, Click on Check in at Solution Level



14. Save the project


15. Write in comment and click on Check In




16. Click Yes


17. Project is check in successfully

18. In Solution Explorer, A locked is appeared beside a solution name after a solution is checked In.



19. Click on Build and then Build a Solution

 20. Upon Build is successful, Click on Publish a solution


 21.       Click on Edit

22. Type Server Name in Server name

23. As a result, Target database connection is filled.

24. Click on Save Profile As 



 25. Save the profile where the solution is located

 26. Save the project

 27.       Check In the solution again.
 28. Write a comment in Check In
29. Click Build and then click on publish solution. Edit Target database connection to the server where database will be created. Then click on Publish
 30. It is successfully published.
31. A database with a table is created. Check in Management Studio.


No comments:

Post a Comment

How to add a Database to AlwaysOn Availability Group with four different options

To add a database to an existing AlwaysOn availability group, MS has given us four options to choose from Automatic seeding Full database an...