Search code examples
sql-server-data-tools

SQL71501:has an unresolved reference to Schema [win]


I am getting a unresolved reference in a SQLProject, the error occurs on the create line. All objects are causing it because they are all being created in a specific schema. For example I have Table that is being created in a specific schema"win" Create Table [win].[DataSource]. The error occurs because of the attempt to create it in the "win" schema If I remove the schema from the create statement the error goes away. The database project is a composite project including all of the artifacts (stored procs, tables, views...) from the win schema. Here is an example of the error I am seeing.

Severity Code Description Project File Line Suppression State Error SQL71501: Procedure: [win].[SelectCandidateExamSearch] has an unresolved reference to Schema [win].


Solution

  • Create script with Build Action: build with the following SQL statement:

    CREATE SCHEMA [win]
    

    where [win] is the schema name.

    For any database project in VS to build sucessfully, ALL its references must exist in the scope of the project and be valid.