Search code examples
c#sql-serverlinq-to-sql

Can't open DBML files - .Net data provider missing?


I have installed Visual Studio 2017 on a new computer, and I am trying to work on my C# project which uses LINQ. Previously, I have worked with Visual Studio 2017 on a Windows 7 machine with SQL Server 2012. Now I need to switch to Windows 10 and SQL Server 2017.

I have installed Windows 10, SQL Server 2017 and Visual Studio 2017 Professional. In the setup of Visual Studio, I activated "LINQ to SQL tools" as well as "SQL Tools".

The project loads and I can actually compile and run everything.

But when I try to open a DBML file in the IDE, I get several error messages:

"Der Extenderprovider konnte keinen Extender für dieses Objekt zurückgeben." (Translated: "The extender provider could not return an extender for this object")

as well as

"Der angeforderte .Net Framework-Datenprovider kann nicht gefunden werden. Er ist ggf. nicht installiert" (Translated: "The requested .Net Framework data provider can not be found. It is probably not installed")

Other problem (probably same origin):

When I try to add a data source and select "Microsoft SQL Server", I receive the message:

"Das Verbindungseigenschaftenobjekt muss vom Typ SqlConnectionProperties oder OleDBSqlConnectionProperties sein." (Translated: "The connection property object must be of type SqlConnectionProperties or OleDBSqlConnectionProperties")

In the drop box I can select ".NET Framework-Datenanbieter für SQL" and ".NET Framework-Datenanbieter für OLE DB" Both don't work.

enter image description here

Here is a screenshot of my setup

enter image description here


Solution

  • It turned out that I had to changed the machine.config file ( %windir%\Microsoft.NET\Framework64\(version)\config\machine.config ) and remove the extra line <DbProviderFactories/>. This solves both problem plus a third problem where I couldn't use the View-Designer in SQL Management Studio.

    Machine.config extra line

    Update: This issue still happens with a fresh installation of Visual Studio 2022! It's amazing that Microsoft doesn't fix this showstopper after nearly 4 years.