Migrating 2019 Visual Studio SQL Server Unit Test Case Projects to 2022 or 2026

T P, Sreejith 0 Reputation points
2026-02-03T06:31:15.0033333+00:00

According to Microsoft documentation, data unit test projects created in Visual Studio 2017 and earlier rely on GAC-installed dependencies. To upgrade such projects to use the latest dependencies, the recommended approach is to right‑click the project in Solution Explorer and select Convert to SQL Server Unit Testing Project.

Unfortunately, this option does not appear for me in Visual Studio 2022 or 2026, even after installing all required components, including Visual Studio Data Tools under the Data storage and processing workload.

Additionally:

  • When attempting to create a new unit test project, the Create Unit Tests option is disabled.
  • If I instead create a standard MSTest Unit Test Project and try to inherit from SqlDatabaseTestClass, the test cases fail to run. Test discovery reports the warning:

“Not all tests from the test run selection could be discovered.”

I am looking for guidance or a supported workaround to resolve these issues and enable SQL Server unit testing in newer versions of Visual Studio.

Developer technologies | Visual Studio | Testing
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2026-02-03T06:31:28.33+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To migrate SQL Server Unit Test Case Projects from Visual Studio 2019 to 2022 or 2026, you need to be aware that the support for certain project types has changed. In Visual Studio 2022, SQL Server Integration Services (SSIS) Projects extension is available, which may help with some SQL-related testing scenarios. However, the specific option to convert older database unit test projects directly may not be available as expected.

    Here are some steps and considerations to help you resolve the issues you're facing:

    1. Ensure Extensions are Installed: Make sure you have the necessary extensions installed for SQL Server Data Tools (SSDT). This includes the Microsoft Analysis Services Projects and Microsoft Reporting Services Projects, which might not directly relate to unit testing but are essential for SQL Server projects.
    2. Creating New Unit Test Projects: If the Create Unit Tests option is disabled, ensure that your Visual Studio installation includes the Data Storage and Processing workload. This workload is crucial for database-related projects.
    3. Using MSTest: If you are creating a standard MSTest Unit Test Project and trying to inherit from SqlDatabaseTestClass, ensure that you have the correct references and that your project is set up to recognize SQL Server testing classes. The warning about test discovery indicates that there may be configuration issues or missing dependencies.
    4. Manual Upgrade: If the automatic conversion option is not available, you may need to manually create a new SQL Server Unit Testing Project and migrate your test cases over. This can involve recreating the tests based on the logic from your previous projects.
    5. Consult Documentation: For detailed troubleshooting, refer to the official Microsoft documentation regarding SQL Server unit testing and any updates related to Visual Studio 2022 and 2026. This may provide insights into any changes in the testing framework or additional steps required for migration.

    If these steps do not resolve the issue, consider reaching out to the Visual Studio Developer Community for specific guidance related to your scenario.


    References:

    0 comments No comments

  2. Susmitha T (INFOSYS LIMITED) 2,360 Reputation points Microsoft External Staff
    2026-02-03T11:06:09.2166667+00:00

    Thank you for reaching out!

    SQL Server Unit Testing projects are legacy SSDT features and are no longer supported in Visual Studio 2022 and later. As a result, conversion options and test discovery do not work in newer Visual Studio versions.

     
    To continue using these tests, Visual Studio 2019 must be used. For long-term support, Microsoft recommends migrating database tests to standard MSTest/xUnit projects that execute database logic correctly.

     

    Reference: https://learn.microsoft.com/en-us/visualstudio/releases/2026/port-migrate-and-upgrade-visual-studio-projects

    Let me know if you need any further help with this. I will be happy to assist.
    If you find this helpful, Kindly mark the provided solution as "Accept Answer", so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.


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.