I recently ran into an issue where the SSDT compiler in Visual Studio was misreporting an error and I wanted to post about the setup and work-around.
SSDT, also known as SQL Server Data Tools, is an add-in for Visual Studio that allows you to develop and deploy SQL database projects.

The Setup

SSDT allows you do some nice things such as turn on code analysis for best practices and treat any warnings as errors. In addition, in order to keep your code clean it also gives you an option to “Validate Casing on Identifiers”.

We have this enabled, as seen below.
ValidateCaseProjectSetting

We use synonyms to isolate our connection points between databases as such.
CreateSynonym

Normally, this works without a hitch as we do a straight data extract before performing our transforms. However, for performance we needed to do some record limiting and add a join between two synonyms, as such.
JoinedSynonym

As soon as we added the join and tried to build the compiler started misreporting an error:
SSDTSynonymError71558

The Solution

There are a few solutions.
For one we could turn off the project property “Validate casing on identifiers”. However, because having this enabled is helpful we did not want to disable it.
Since our data pull logic was isolated in a stored procedure we instead opted to just turn off this error check for the single procedure, until Microsoft releases a fix.

To disable the error on the procedure you only need to right-click on the procedure and view properties, and on the properties page enter the error number “71558” into the Suppress TSql Warnings property.
SSDTSupressErrorInProperties

I did find some an old post in 2011 describing this problem. Hopefully, it will be fixed in a future version of SSDT.

Let me know if you found this post useful, or if you have any other tips and tricks you have found for synonyms in the comments below.