Unresolved References to Same Database Project

前端 未结 2 2065
庸人自扰
庸人自扰 2021-02-13 02:16

I\'ve created a SQL Server database project in Visual Studio 2013 and imported a DACPAC taken from a production database. When I tried to build the project I get hundreds of SQ

2条回答
  •  一个人的身影
    2021-02-13 02:41

    Well actually there are two workarounds. My personal opinion is that there is a bug in SSDT concerning 3-part object names in the current database.

    1. Create your project snapshot (dacpac) and reference it as a database reference. Remember to clear database variable field in the 'Add database reference' dialog.
      It works however this approach is not recommended by Microsoft and can cause other problems: https://connect.microsoft.com/SQLServer/feedbackdetail/view/1047094/post-deployment-script-is-not-generated-in-the-publish-script

    2. At your code replace all occurrences of MyDatabase.dbo.MyTable with [$(DatabaseName)].dbo.MyTable
      https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1863d960-d32d-4920-9a30-13dc86c6f857/sql71562-unresolved-reference-to-object-followd-by-database-name-in-the-same-project?forum=ssdt&prof=required

提交回复
热议问题