How do I resolve SQL71501 errors for logins in a SQL Server Database Project when “Server Project” is not available in Visual Studio 2022?


I’m working with SQL Server Database Projects in Visual Studio 2022. My project contains users that are based on logins created at the SQL Server level (e.g., CREATE USER [readonly] FOR LOGIN [readonly]). When I build the project, I get SQL71501 errors because the logins are not defined in the database model.

I understand that in the past, a “SQL Server Server Project” could be used to model server-level objects like logins, and then referenced from the database project. However, I cannot find the “Server Project” template in Visual Studio 2022, even though I have all the Data storage and processing workloads and SQL Server Data Tools installed.

I tried creating a separate database project to hold login definitions (e.g., CREATE LOGIN [readonly] FROM WINDOWS;) and referencing it from my main project, but the reference dialog seems to expect DLLs or DACPACs, and I can’t get the login references to resolve.

Questions

  • Is there a supported way in Visual Studio 2022 to model and reference server-level logins in a database project to resolve SQL71501 errors?
  • If the “Server Project” template is deprecated, what is the recommended approach for handling users based on server-level logins in SSDT?
  • Are there any workarounds or best practices for this scenario?
    Any guidance or updated best practices would be appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *