3

I am working on a C# project with SQL Server. For development, we use LocalDB instance of SQL Server. If something is changed in the database, we check-in the .mdf/.ldf files into TFS. The connection is made using MSSqlLocalDB.

The problem

After upgrades on some systems, we are now using VS 2013 and VS 2015, both for development. The issue started because of the fact that VS 2013 defaults to SQL Server 2014 and VS 2015 defaults to SQL Server 2016 for LocalDB instances.

Once the .MDF file has been opened with 2016, it becomes incompatible with 2014. Due to this, people using 2015 can't check-in the database changes.

To solve it, I installed Version 2014 of LocalDB on to machines with VS 2015 but unable to change the default version to which VS connects to.

CAN ANYONE HELP ME??

Thanks in advance...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Bimal
  • 350
  • 1
  • 7
  • 21
  • 12 days and not even a comment???? – Bimal Sep 05 '16 at 05:32
  • Just out of curiosity, wouldn't be easier to use named instance of localdb instead of relying on automatic instance? You can use `SqlLocalDB` command line utility to create instance of specific version. – eXavier Feb 16 '17 at 08:49
  • @eXavier: Well! that can be done. but then it will be required that each system on which development is going on should have an instance of the same name. And to create the version specific instance with `SqlLocalDB`, the creator should have knowledge of its command line options. I tried it on a system and had to struggle a little bit with finding the correct version of SQL server 2014. But it was nice to know this options also. :) – Bimal Feb 16 '17 at 16:18
  • Sure. But it could be scripted (or documented) and be part of dev-machine setup routine (as well as installing VS, SQL Server, etc). Still it seems to me easier and more robust (regarding to future versions od LocalDb) than steps you described in your answer. Just an anlternative.. – eXavier Feb 16 '17 at 16:29
  • 1
    Yes. And after finding it, may be i can write a prebuild script or configuration section changes to do it automatically. Also found an answer to similar problem just now : http://stackoverflow.com/a/40055554/561256 – Bimal Feb 16 '17 at 17:31

1 Answers1

3

It took me 2 days to find the solution to this problem.

Posting here for anybody who faces the issue in future.

I basically removed all instances of LocalDB from my system and reinstalled them. Following are the steps that were required to finally solve the issue

  1. Remove all the databases attached to the LocalDB 2016
  2. Remove LocalDB 2016
  3. Remove LocalDB 2014
  4. Restart the system
  5. Reinstall LocalDB 2014

For installation of LocalDB 2014, either use the standalone file from "https://www.microsoft.com/en-in/download/details.aspx?id=42299" OR Select Express from standard Sql Server Setup and then select LocalDB in the component list

Edit 1

I have found another user having similar problem(Link). Please see the answers there also. IMO The answer there may be preferable than mine above which involves uninstall of SqlLocalDB 2016 and that may break other applications using it.

Community
  • 1
  • 1
Bimal
  • 350
  • 1
  • 7
  • 21