2

When I import a DACPAC into a VS SS DT project, it creates a very nice folder structure for me: all my schemas are defined under a folder called "Security" and then each schema has its own named folder that contains folders called "Tables", "Stored Procedures", etc. However, if I right-click on the project name and select Add > Table, the new table is just added in the project's root. This doesn't seem right at all. Is there some way to get VS to honor the organized file structure that is created when I import a DACPAC?

admdrew
  • 3,790
  • 4
  • 27
  • 39
Dan Forbes
  • 2,734
  • 3
  • 30
  • 60
  • Have you tried adding it through the SQL Object Explorer window for the Project? That might do what you're wanting automatically and it looks a little more like SQL Server Management Studio as a benefit, regardless of file/folder structure. – Peter Schott Oct 20 '14 at 14:37
  • Unfortunately that does not work. I right-clicked on the Programmability > Stored Procedures folder for my project in the SQL Server Object Explorer pane and selected "Add a New Stored Procedure...". After giving the stored procedure a name of the form ````.```` and clicking "Ok", the script to represent my procedure still landed in my project's root directory. Thanks for the suggestion, though...I was hopeful! – Dan Forbes Oct 20 '14 at 14:44

2 Answers2

2

I've found that the best way to deal with this is not make VS-side changes, but instead make SQL Server-side changes. After making the changes to the DB in question, I do a schema compare against the actual DB on the SQL Server, and the VS project. When I update against the diff, the nice structure is maintained.

Dan Forbes
  • 2,734
  • 3
  • 30
  • 60
  • 1
    If the nice folder structure is only for friendly UX during development, working in the SQL Server Object Explorer (instead of the Solution Explorer) uses the same nice folder structure as SSMS. – Aaroninus Mar 30 '16 at 14:12
  • 1
    Yeah but if you are using VS+SSDT for source control (as part of the CI/CD process), then you need to be able to push changes to the database server, not pull them back. – blobbles Aug 19 '20 at 02:55
0

That's because you added the table to the root folder level (e.g. right-clicked on project name). Instead, right-click on the folder named "Tables", and you can then add the table definition under that.

Wayne S.
  • 104
  • 4