ASP.NET MVC and Web API – Fix – Database cannot be opened… version…

ASP.NET MVC and Web API
Fix / how-to

The database ‘{0}’ cannot be opened because it is version {1}. This server supports version {2} and earlier. A downgrade path is not supported.

 

Get a project from another computer, cannot use its database

Scenario:

You have a project that was created on another computer. However, when you load it, shows an error in a dialog box, with text similar to the following:

The database ‘{0}’ cannot be opened because it is version {1}. This server supports version {2} and earlier. A downgrade path is not supported.

The error message is reasonably informative, but here’s some more translation:

The other computer has a database server engine that’s newer than the one that’s active on your computer.

Why is this happening, even if both computers have Visual Studio (VS) 2015 with Update 3? Well, the problem computer may have had an older version of VS 2015, for example one without an update, or with an earlier update. Or, the computer may have had a previous version of VS (e.g. 2013), and VS continued to use the older activated database engine.

The only viable solution is to activate a newer database server engine on your computer.

 

How to fix

Open the Package Manager Console. The plan is to type some commands, which will deactivate any older versions of the database server engine, and instead activate the current/recent version.

First:

sqllocaldb stop v11.0
sqllocaldb delete v11.0

sqllocaldb stop MSSQLLocalDB
sqllocaldb delete MSSQLLocalDB

 

Don’t worry about the scary use of the word “delete”. It will NOT delete your database. It will delete the setting that VS uses to identify and activate (start) the per-instance on-demand database server engine.

Now, reconfigure these settings. We have observed that one or the other of the following commands will work. If the first command yields an error, try the second command:

sqllocaldb create MSSQLLocalDB

sqllocaldb start MSSQLLocalDB

 

Feedback

If this procedure does NOT work for you, feel free to contact me.

 

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Advertisements
%d bloggers like this: