Share via

SQL71562: Unresolved Reference to Object [$(dbVariable)].[sys].[objects] After Upgrading to VS 2022 (17.12) Pro

Jason Selburg 5 Reputation points
2024-11-19T14:50:36.1533333+00:00

A SQL Server Data Tools (SSDT) solution that has been used for several years includes multiple database projects, some referencing the master database and/or using [sys] tables in other referenced database projects within the same solution. This solution was configured with database references and functioned properly in VS 2019.

For example, the [MAIN_CODE] (db project) has stored procedures that reference [$(DATA01)].[sys].[tables] in the [DATA01] (db project) and/or [msdb].

After upgrading to VS 2022 Professional, the following error occurs: "71562: Unresolved reference to object [$(dbVariable)].[sys].[objects]." This error appears for all references to other database projects that refer to the [sys] schema, presumably those related to the [master] or [msdb] databases.

  • Attempts to resolve the issue, including removing and re-adding references, restarting Visual Studio and the PC, switching to INFORMATION_SCHEMA tables (which is not feasible due to references to [sys].[indexes]), and changing the target platform back to SQL 2019 with re-added references, have not been successful.
  • Additionally, creating a new .dacpac in the respective databases from a SQL 2022 server's [master] database and replacing it in the VS folder, as well as creating a new SSDT project named [master] and importing the existing .dacpac (which has encrypted/hidden object definitions), did not resolve the issue.

It appears that VS 2022 SSDT does not resolve projects' [sys] schema or objects correctly.

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Jason Selburg 5 Reputation points
    2024-11-20T21:38:46.7333333+00:00

    UPDATE: This issue appears to be resolved with the Update 17.12.1

    Was this answer helpful?

    1 person found this answer helpful.

  2. Ki-lianK-7341 1,105 Reputation points
    2024-11-19T15:00:27.4866667+00:00
    1. Add Database Reference to Master:
      • Right-click References > Add Database Reference > System database > master.
    2. Check .sqlproj File:
      • Ensure the master database reference is correctly defined in your .sqlproj file.
    3. Update SSDT and Visual Studio:
      • Make sure both are up to date.
    4. Rebuild Solution:
      • Clean and rebuild your solution.
    5. Use Fully Qualified Names:
      • Ensure all system object references are fully qualified

    Was this answer helpful?

    1 person found this answer helpful.

  3. Jim McAleer 0 Reputation points
    2026-05-21T14:54:58.3466667+00:00

    I went round and round with this, but my issue appears to be around the target platform specifically the "SQL Server 2022 or Azure SQL Database Managed Instance." So, make sure you downgrade to SQL Server 2019 or any version below.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.