For .NET Core Database-First scaffolding, how do I get the server connection ?

Babak Sekandari
Babak Sekandari used Ask the Experts™
on
Hi,
I have an ASP.NET MVC Core 2.1.1 project running in Visual Studio 2019.
Since I have already created a database, I want to connect the application to the existing database with database-first development.
From the Visual Studio, Package Manager Console, I put in:

Scaffold-DbContext "server=ServerName;Database=DbName; Trusted_Connection=true; Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

That gives me the following error:
The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.8-servicing-32085'. Update the tools for the latest features and bug fixes.
Unable to find provider assembly with name server=ServerName. Ensure the specified name is correct and is referenced by the project.

I got the name, ServerName, directly from the Visual Studio connection properties:
Data Source=ServerName; Initial Catalog=DbName; Integrated Security=True

Is there something different I should put for ServerName?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chief Technology Ninja
Distinguished Expert 2018
Commented:
Hi Babak,

Scaffold-DbContext "server=ServerName;Database=DbName; Trusted_Connection=true;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

Open in new window


You were missing a double-inverted comma.

Regards,
Chinmay.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial