Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Error Opening SDF File" For Any and All C++ Projects in VS2015

Any C++ projects I create or open in VS2015, I get this error:

An error occurred while creating or opening the C++ browsing database file WHATEVER.sdf. IntelliSense and browsing information will not be available for C++ projects.

Ensure that Microsoft SQL Server Compact 4.0 is installed and that no other applications are accessing the file. If this problem persists, delete the file and reopen the solution.

Which means that there is no IntelliSense, etc. which is half the reason I use Visual Studio in the first place. I'm using Visual Studio 2015 Enterprise edition on Windows 8.1, and this happens for all C++ projects. The SDF file doesn't actually get created at all, so there is no file to delete.

What I have tried so far; none had any effects:

  • Making sure SQL Server Compact 4.0 is actually installed (it was.) The version was 4.0sp1, which I tried replacing with 4.0 anyways, but it informed me that a newer version already existed and nothing needed to be done.
  • Running VS with elevated (administrator) privileges.
  • Creating projects in different directories (e.g. under the default VS project path, in the root of a drive, on another drive, on paths with no spaces in them, etc.)
  • Repairing Visual Studio installation (twice.)
  • Using the "fallback location" for the SDF file (under Tools->Options->Text Editor->C/C++->Advanced->Fallback Location) with exactly the same effect.

Running VS (devenv.exe) with /Log command line option and opening a project and then closing VS gives me a 600KB+ XML file, which I can't read, and a cursory search revealed no suspicious entries.

Any hints/suggestions/solutions?

like image 830
yzt Avatar asked Sep 06 '25 17:09

yzt


2 Answers

I've just come across this problem myself, on Windows 10 with the Visual Studio 2015 Update 1 installed moments prior.

Downloading the SQL Server Compact 4.0 SP1 installer, and repairing the installation, seemed to rectify the situation nicely.

https://www.microsoft.com/en-gb/download/details.aspx?id=30709

like image 183
Jake Hendy Avatar answered Sep 08 '25 23:09

Jake Hendy


I just fought a minor war against this issue (messages as in the OP, and Intellisense completely disabled across the board) with Visual Studio Professional 2012 Update 5 on Windows 7 Professional 32-bit SP1 (fully updated) running under Virtual Box 5.2.8 (the host OS is Windows 10 Pro 64-bit, fully updated.)

I tried everything, including the solution suggested by Jake Hendy above - nothing helped. I even tried completely force-uninstalling and then clean-reinstalling the entire Visual Studio, as well.

A clue came when I recalled that I saved a snapshot of my VM several months ago, when everything was working just fine - I tried restoring to that snapshot, but the problem persisted! This made me suspect that maybe it's not the OS or the software installed/running in it per se, but actually the hypervisor that was somehow causing the problem: I upgraded to Virtual Box 5.2.8 from 5.2.6 fairly recently. So I re-downloaded and re-installed Virtual Box 5.2.6 (on top of the pre-existing 5.2.8 install, essentially replacing it) - and indeed the problem went away!

So, for anyone running a legacy development environment on a legacy OS inside a VM - if you run into this type of issue, consider what recent updates have occurred to your hypervisor. Apparently, SQL Server Compact 4.0 SP1 does something rather finicky or super-"advanced" under the hood, and can be subtly broken by obscure (possibly security-related?) changes deep in the operating environment. It's kind of mind-blowing how exactly one application gets broken by a hypervisor change like this - while everything else seems to still work without any issues...

Anyway, this was my particular (admittedly, rather corner-case) problem and solution - unlikely as it may be, I hope this helps someone else in a similar situation.

like image 32
Boris Shpungin Avatar answered Sep 08 '25 22:09

Boris Shpungin