Issue creating Service-Based SQL Database in Visual Studio 2022

John Dyson 45 Reputation points
2024-07-27T06:44:54.7333333+00:00

I am attempting to create an SQL Database in visual studio 2022:

User's image

I get the following error:

User's image

even though sql client has been added as a package reference:

User's image

Any thoughts? thanks

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,202 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.
14,014 questions
0 comments No comments
{count} votes

Accepted answer
  1. Tianyu Sun-MSFT 31,326 Reputation points Microsoft Vendor
    2024-07-29T03:13:52.15+00:00

    Hello @John Dyson ,

    Please try to reinstall the Data storage and processing workload from VS Installer > Modify > Workloads.

    Actually, there’s no need to install the separate NuGet package, but it’s strange that the error persisted after you installed the NuGet package. I guess there’s something wrong in settings or framework.

    Try to install .NET 8.0 manually and see if this works(Download .NET 8.0).

    Please also try to repair VS(VS Installer > More > Repair), create a new project and add the "Service-based Database" item again. If this still doesn't work, I would recommend trying to reinstall VS 2022.

    Some other suggestions:

    1. Delete the bin, obj and the hidden .vs folder in your solution/project folder. Rebuild your project and then try to add the "Service-based Database" item.
    2. Tools > NuGet Package Manager > Package Manager Settings > click "Clear All NuGet Storage" button, try to reinstall the NuGet and add the item again.
    3. Update VS 2022 and reset VS(run devenv /ResetSettings command in Developer Command Prompt for Visual Studio 2022).

    Feel free to contact us and let us know the results:)

    Sincerely,

    Tianyu


    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.