microsoft / DacFx

DacFx, SqlPackage, and other SQL development libraries enable declarative database development and database portability across SQL versions and environments. Share feedback here on dacpacs, bacpacs, and SQL projects.
https://aka.ms/sqlpackage-ref
MIT License
348 stars 20 forks source link

error SQL71501 for synonym referencing a table in another database in same solution #520

Open mrlmachado opened 6 days ago

mrlmachado commented 6 days ago

Steps to Reproduce:

  1. Create a synonym for a table in another database (same solution, different .sqlprojx file referenced in .sqlprojx) e.g.
    CREATE SYNONYM dbo.Table$Archive     FOR [$(DB_Archive)].dbo.Table;
  2. Use the Synonym inside a view

It will throw the below error when trying to build the solution with dotnet build:

Build error SQL71501: View: [dbo].[TableLog] has an unresolved reference to object [dbo].[Table$Archive].

Did this occur in prior versions? If not - which version(s) did it work in? I'm trying to convert my old .sqlproj file to new sdk-style to apply custom code analysis and it's failing to build because of the above error SQL71501

(DacFx/SqlPackage/SSMS/Azure Data Studio)

ErikEJ commented 6 days ago

Maybe it is better to attempt this with Azure Data Studio for the time being.

mrlmachado commented 6 days ago

Hi @ErikEJ ! Thank you for your blazing fast response to my thread. We are actually trying to upgrade from SSDT VS ancient style to the new-sdk style. We can still wait, of course, for this bug to be fixed until we can fully upgrade.

mrlmachado commented 5 days ago

@ErikEJ , just an update: