Errors during build of SQL Server 2022 Projects with VS2019 Professional & AzureDataStudio

Radhai Krish 191 Reputation points
2024-09-18T06:08:31.24+00:00

Stuck with this issue for longer time.

I am trying to create SQL Server Projects for a DB being in SQLServer2022 using VS2019 Professional.

DB is old running/being in use since 2009.

How much ever I try I face the following warnings & errors, but of huge numbers

Build warning SQL71562: SqlProcedure: --- has an unresolved reference to object---

Build warning SQL71502: SqlProcedure: --- has an unresolved reference to object---

Build error SQL71501: SqlUser: [] has an unresolved reference to SqlLogin [].

Upon searching on google, I am unable to find any solution that would fix this issue.

Also, there isn't any proper documentation in MS (as far as I searched) where we could get proper explanation/guidance to reach out the solution.

1 thing to add, I am trying from both VS2019 and AzureDataStudio. But no luck from both.

But the AdventureWorks DB - I am able to create projects as well as able to build without any errors/issues.

Possible to help?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,059 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,690 questions
Azure Data Studio
Azure Data Studio
A cross-platform database tool for data professionals using on-premises and cloud data platforms on Windows, macOS, and Linux.
112 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 44,311 Reputation points
    2024-09-18T06:28:50.94+00:00

    has an unresolved reference to object

    You get that warning/error, when you reference an object, that do not longer exists, e.g. because it's deleted.

    And you get it, when you have cross-database queries; is that the case here?


  2. LucyChenMSFT-4874 4,430 Reputation points
    2024-09-18T08:08:49.3466667+00:00

    Hi @Radhai Krish ,

    Thank you for your reaching out and welcome to Microsoft Q&A!

    According to the message '71562' and '71502' shown in the issue, this is actually a warning and not an error. An error will stop the build process and prevent the project from being published to the server. Warnings merely show up in the "Error List" window, but don't prevent the build or publish processes from completing. Please refer to this official documentation if you don't want to see these warnings.

    Regarding the error 71501, you could manage to solve it by first creating the login and then create the user.

    -- Windows Account
        CREATE LOGIN [Domain\Username]
        FROM WINDOWS WITH DEFAULT_LANGUAGE = [us_english];
    
        GO
    
        CREATE USER [Domain\Username] FOR LOGIN [Domain\Username];
        GO
    
        -- Sql Acccount
    
        CREATE LOGIN [sql_account] WITH PASSWORD = 'Ch@ngeth1spA$swurD'
        GO
    
        CREATE USER [sql_account]
        FROM LOGIN [sql_account]
        WITH DEFAULT_SCHEMA = dbo
    
        GO
    
    
        -- Then set the sql file Build Action to "Build"
    

    Feel free to share your issues here if you have any concerns.

    Best regards,

    Lucy Chen


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    https://docs.microsoft.com/en-us/answers/support/email-notifications


Your answer

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