microsoft/DacFx

Unresolved reference error creating synonym on table and type with same name

zijchen opened this issue · 1 comments

  • SqlPackage or DacFx Version: 162.2.111 (Microsoft.Build.Sql 0.1.15-preview)
  • .NET Framework (Windows-only) or .NET Core: both
  • Environment (local platform and source/target platforms): Windows

Steps to Reproduce:

  1. Create database project with this script:
create table abcd (id int);
go

create type abcd from int;
go

create synonym syn_abcd for abcd;
go
  1. Build will result in this warning:

Build warning SQL71502: Synonym: [dbo].[syn_abcd] has an unresolved reference to object [dbo].[abcd].

This is just a min repro. The warning turns into an error when the objects are coming from dacpac/database references (original VS feedback).

This was likely caused by the change to fix #327. According to the docs you cannot create a synonym to a User Defined Type (technically you can but you won't be able to use it). We likely just have to update the place in DacFx code where it resolves synonym object references to ignore UDTs.

Did this occur in prior versions? If not - which version(s) did it work in?
Worked in all versions prior to DacFx 162.2.111/SDK 0.1.15-preview

(DacFx/SqlPackage/SSMS/Azure Data Studio)