224

I would like to know if I can safely delete the sdf file that stores information for Visual Studios Intellisense - is it going to be rebuilt the next time that I open the solution?

Do I lose anything by doing so? Is it possible to break the solution this way?

The motivation to do so is that by having multiple small projects stored - each and every sdf file is more or less 20Mb in size which adds up to a noticeable amount of disk space.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
kubal5003
  • 7,186
  • 8
  • 52
  • 90

5 Answers5

351

You can safely delete the .sdf file and ipch folder but you can also stop VS from putting those files in the project folder in the first place. (Useful if you have your source in an SVN or other synchronised folder, or if you store your project on a small volume like a USB stick or SSD and you don't want those large files stored in the same folder)

Go to Tools -> Options -> Text Editor -> C/C++ -> Advanced

In the "Fallback Location", set "Always Use Fallback Location" to True and "Do Not Warn If Fallback Location Used" to True.

In "Fallback Location" you can either put a path like C:\Temp or if you leave it blank then VS will use the temporary directory in your AppData folder.

Failed Scientist
  • 1,977
  • 3
  • 29
  • 48
Ozzah
  • 10,631
  • 16
  • 77
  • 116
  • 6
    Using git. This is going to save us many man hours of closing visual studio. – GCon Nov 10 '13 at 14:54
  • Is there a similar settings for Visual Studio 2008? In C/C++, there is no Advanced :(. – the swine Oct 14 '14 at 19:13
  • @GCon using git you can add these files/folders inside `.gitignore` – Christos Lytras Jun 29 '20 at 22:26
  • @ChristosLytras The issue in older visual studios (and very large projects) is the time it takes to load (and close) projects. I don't know if it has been fixed in newer versions, or it was just a side effect of my last job's very bad practices. – GCon Jun 30 '20 at 01:05
  • @GCon I never had a very large project (*hundreds of source code files*) but there is no doubt that `SDF` files can help to reduce loading and compile times. My point is, that we can have these files inside `.gitignore` and never commit them to git repos without disabling VS option to generate them. Once users clone the repos, VS will rebuild these files for performance. – Christos Lytras Jun 30 '20 at 07:30
43

You can safely delete the file. Visual Studio will rebuild the file the next time the solution is opened.

Håvard S
  • 23,244
  • 8
  • 61
  • 72
21

The short answer is yes, you can safely delete the .sdf file.

However, note that you can actually prevent VS from creating .sdf files in the first place by setting the following option to True:

Tools -> Options -> Text Editor -> C/C++ -> Advanced -> Disable Database

DavidRR
  • 18,291
  • 25
  • 109
  • 191
Szabolcs
  • 211
  • 2
  • 2
1

for sake of completeness, you can safely delete: - *.sdf - Debug folders (usually at two levels) - ipch folder (c#)

ingconti
  • 10,876
  • 3
  • 61
  • 48
0

You can delete this local file, don't worry. The SDFwill be from your "xxxDBDataSet.xsd" file. if you change it, the SDF file also be new.

user1012506
  • 2,048
  • 1
  • 26
  • 45