Configuring Visual Studio 2005 for use with SQL Server 2005 Compact Edition

A number of people have been a bit confused how to get SQL Server 2005 Compact Edition (also known as version 3.1) working with Visual Studio 2005.  The fact that we enabled a new product mid-steam within a Visual Studio ship cycle was quite an accomplishment, but there were a few cracks that people fell in, so let me do a quick recap of what you need to do.  Note that the order isn't actually all the important.  We've designed the packages to be installed in any order.

First, some pre-requisites


Visual Studio Standard, Pro, Enterprise or above required - Visual Studio Express SKUs will not work with SQL Server Compact Tools
Because SQL Server Mobile (predecessor to SQL Server Compact) was shipped as part of the Smart Device Programmability, there was no free Express SKU that targeted device programmability.  You can use SQL Server Compact in the Express products, but you will be limited to code scenarios.  The tooling experiences are limited to the standard and above SKU's.

I'm happy to say that Visual Basic & Visual C# 2008 Express SKU will include SQL Server Compact 3.5 as part of their default experience.  In addition, post B2, the SQLce runtime and tools will always be installed, so you won't have to go through this experience.

Smart Device Programmability must be installed to enable SQL Server Compact tools
If your installed VS 2005 with the default options, you can skip this step as you already have Smart Devices installed.

If you chose to customize the VS setup, then you may likely not have Smart Devices installed, so please follow these steps to confirm you have what you need before installing VS SP1.

1: Verify Smart Devices for Visual Studio are installed
The easiest way to verify that Smart Devices are installed is to simply create a new project, and see if you have Smart Devices as an option for creating new projects.

2: Verify SQL Server Mobile tools for Visual Studio are installed

The next thing you'll want to confirm is the SQL Server Mobile tools for Visual Studio are installed.  The SQL Server Compact Tools for Visual Studio SP1 package is a patch to the existing tools, so unless you have the SQL Mobile Tools package installed, you'll be unable to update to SQL Server Compact.

If you've attempted to install the SQLce Tools and received this warning, this is why:

  • Open the Control Panel and launch Add or Remove Programs in Windows XP or Programs & Features in Windows Vista

  • Look for an entry named: Microsoft SQL Server Mobile Tools for Visual Studio
    The exact title may be slightly different.  While writing this I couldn't find any machines that don't already have VS SP1 installed. 

  • If you have this entry, proceed, as you're fine

  • If you don't have this entry, but you do have Smart Devices, then you likely uninstalled the SQL Mobile tools.  Re-run VS setup and chose to reinstall the Smart Devices option

2a: Installing Smart Devices

  • Run the VS 2005 Setup

  • Chose Customize

  • Under Visual Basic, and/or C#, choose Smart Device Programmability
    This will install the Smart Device Templates and the tools for SQL Server Mobile - the pre-requisite for upgrading to SQL Server Compact


1: Install Visual Studio 2005 Service Pack 1

You'll first want to install VS 2005 SP1.  Vista developers should use this update specific to running VS on Vista.  In addition to all the other benefits of SP1, the benefits for SQLce include:

  • Server Explorer "Add Connection" refers to SQL Server Compact Edition, instead of SQL Server Mobile

  • Auto addition of the SQLce Click Once bootsrapper when a .sdf file is added to your Windows Forms project

  • Newly created connection strings for SQLce databases will use the |DataDirectory| macro easing directory management of data files on each end users machine

Just installing VS 2005 SP1 doesn't actually get you the updated SQLce 3.1 engine.  If you just install VS SP1 you may think you have SQLce installed as the Add Connection dialog will list SQL Server 2005 Compact Edition, but it's just a resource string that's part of Visual Studio.  You'll need these next two packages as well.  Navigate to and you'll see several additional packages available. 

2: Install SQL Server 2005 Compact Edition Embedded Engine
The first most important one is the actual SQL Server 2005 Compact Edition engine.  This is version 3.1 that unlocks the power of SQL Mobile for all Windows desktop operating systems.  Note, this is not used for the Windows Mobile platform.  It's the desktop runtime.

  • Full support for all current Windows Desktop operating systems

  • Enhancements allowing private deployment of the SQLce engine, or central/gac'd installation

  • Addition of the |DataDirectory| macro for locating where your applications data directory exists on each users end machine

  • Some minor performance enhancements that take advantage of the desktop environment compared to the more constrained Windows Mobile environment


3: Install SQL Server 2005 Compact Edition Tools for Visual Studio 2005 Service Pack 1

Once you have the unlocked engine, you'll want to get the updated tools.  This package includes bug fixes and new deployment features for SQLce under Click Once including the following:

  • Updates the table editor, database creation and other related SQLce dialogs

  • Addition of a Click Once bootsrapper for pre-reqing SQL Server Compact when deployed with Click Once

4: Install SQL Server Compact Documentation

Lastly, you may want the updated documentation for the newly enabled scenarios

A quick verification

With these steps you should now have SQL Server 2005 Compact Edition full installed and ready to go. To verify everything went well, you can check Add Remove Programs for the following entries:

  • Microsoft SQL Server 2005 Compact Edition [ENU]

  • Microsoft SQL Server 2005 Compact Edition Books Online [ENU]

  • Microsoft SQL Server 2005 Compact Edition Tools for Visual Studio 2005 [ENU]

The [ENU] suffix indicates these are the English versions.  Server Tools is an optional component required when using Merge Replication or Remote Data Access  (RDA)

You can also check to see if the following directory exists:
\Program Files\Microsoft SQL Server Compact Edition\v3.1

This directory includes the native runtime and managed provider.  Note, you no longer need to manually add a file based reference to the System.Data.SqlServerCe.dll.  When you install the SQL Server Compact  Tools for Visual Studio 2005 SP1, a entry is made in the registry enabling the Add Reference dialog to properly display the System.Data.SqlServerCe reference in the .NET tab.

Happy coding,


Comments (24)

  1. Thanks for latest info

    My Microsoft SQL Server 2005 Compact Edition [ENU] still shows ENU (As do a number of other programmes)

    Does this mean that the latest edition is NOT on the MS Download page or have I got the correct version

    have eamil a coy of my add programmes


    Keep up the brilliant work


  2. David Kline says:

    While I am not (yet) much of an expert on databases, I was excited to see Steve Lasker post instructions

  3. Steve Lasker says:

    Bill Vaughn graciously gave me a bunch of feedback on some gotchas that he and others have ran into.  So, I’ve updated the post with several images, verification steps, qualifiers for Express and the Visual Studio SP1 for Vista link.  Thanks again Bill

  4. Thanks for the article. I have a problem though. I’ve followed all the steps, but in the Add Reference screen I still see the SqlServerCe dll with version 3.0.3600.0 even though the actual file version is 3.0.5300.0!

    Then when I add the reference it tries to reference 3.0.3600.0. I installed Sql Compact using the cab file and I get a runtime error because it looks for version 3600, but I only have 5300 on my device.

    Any idea how I can get rid of the 3.0.3600.0 reference in Visual Studio?

  5. Steve Lasker says:

    Hi Jeffery,

    The solution I described is actually for desktop scenarios. The SQLce 3.1 release was really the 3.0 SQL Mobile release for the desktop. There wasn’t anything substantial, other than some bug fixes for the device version.

    For devices, you don’t want to manually reference the files in the c:program files directory as those are for desktop, and will vconfuse the fx runtime trying to resolve the desktop managed provider and desktop stack.


  6. Hi Steve,

    I thought I knew I understood how it worked, but now I’m not so sure anymore :).

    When I installed the Sql Compact tools, it also updated the cab files in c:program filesmicrosoft visual studio 8smartdevicessdksql servermobilev3.0 etc.

    When I use these cab files to deploy, it deploys the Sql Compact Core and not Sql Mobile 2005 anymore. And because the reference is still to version 3600 it fails.

    I could just keep deploying Sql Mobile 2005 to the device and not upgrade. Are you saying there’s no substantial differences between the two for devices? Because then I might as well stay with 2005. But still, this confuses me a lot.



  7. Marcin Smolka says:


    I have smart devices programing installed (I can choose any smart device application project from visual studio create project option), I have also SP1 installed for visual studio, but I still have error that tools can not be installed. I’ve also rerun setu and checked if smart devices are selected and everything is correct. But I still have that error.

    Have you any idea why it can happen?



  8. Steve Lasker says:

    Hi Marcin,

    Can you verify you have the SQL Server Mobile tools installed? You should see it in Add/Remove programs. The SQL Server Compact Tools are an update to the SQL Mobile tools. So, if you uninstalled the SQL Mobile tools, or somehow didn’t get them installed, the update to SQL Server Compact tools won’t work.


  9. Sql server Ce 3.1 .. istallazione faticosa.

  10. Stamane debbo fare un lavoro urgent per un cliente, sviluppo su mobile e necessità di sql server, vado

  11. grauenwolf says:

    Thank you so much! I was tearing my hair out trying to get it to work.

  12. Is it possible to use the SQL Server 2005 Compact Edititon 3.5 with Visual Studio 2005 ?

    And if yes pleas let me know how.

    Thanks Regards


  13. Steve Lasker says:

    Hi Stephan,

    Yes, you can use SQL Server Compact 3.5 with Visual studio 2005… sort of.  …meaning, you can use the code scenarios, add references, instance objects, etc.  However, tooling for SQL Server Compact 3.5 is limited to VS 2008.  


  14. ekoseos says:


    You are saying SQL Server CE 3.5 can be used with VS 2005? The reason is that the mobile I am deploying too has its own SDK (C++) that can only integrate with VS2005 (no VS2008 upgrade as yet); What do you mean by tooling? Can I use SQL Server 2005 Management Studio to access CE 3.5 as the "tooling".

  15. Steve Lasker says:

    Hi Ekoseos,

    What I mean by "tooling" is the VS Designers including the DataSet designer, Server Explorer and Connection Dialogs.  Basically any tool (VS or Managmenet Studio) that has to display UI to communicate with SQLce will only be enabled as described:

    VS/Management Studio 2005 = SQL Server Compact 3.1

    VS/Management Studio 2008 = SQL Server Compact 3.5

    Hope that helps explain,


  16. Peter says:

    So to work with the DB files for SqlCE (3.5) we need to install the Express version of C# (as an example) and edit them from there, correct? I guess you might tell us just to upgrade to VS 2008 🙂 ?

  17. Steve Lasker says:

    Hi Peter,

    ummmm, yes.  Due to tight schedules and resource constraints, we were unable to support multi-targeting of tooling.  

    …but, we did get the express tools integrated with SQLce 3.5, so you don’t have to purchase the professional product just to get started.


  18. Clint Teune says:

    Can SQL Compact edition work with Visual Studio Tools for Office.  I thought that VSTO sat above Visual Studio Standard and along-side VS Pro but the SQL Ce tools are not available during the installation process.

  19. WideCharacter says:

    Hi Steve,

    The very end of you post says,

    "Note, you no longer need to manually add a file based reference to the System.Data.SqlServerCe.dll.  When you install the SQL Server Compact  Tools for Visual Studio 2005 SP1, a entry is made in the registry enabling the Add Reference dialog to properly display the System.Data.SqlServerCe reference in the .NET tab."

    I’m not seeing this behavior.  The .Net tab continues to offer SQL CE 3.0 for SqlServerCe and SqlClient.  I’ve seen this on my own box, and another on which I installed VS 2005 SP1 for the first time.

    Can this be tweaked manually?


  20. meannn says:

    That is the point > VS/Management Studio 2005 = SQL Server Compact 3.1

    VS/Management Studio 2008 = SQL Server Compact 3.5


  21. meannn says:

    And you are totally right that, The SQLce 3.1 release was really the 3.0 SQL Mobile release for the desktop…

  22. therock112 says:

    well, thanks very much Microsoft for confusing the hell out of everyone.

    Ok, I hope i get this right, I have only read this a dozen times!!

    I have VS 2005 with SP1, I want to develop for WM 5 and WM 6.

    Ideally I want to develop only once and hopefully it will work on WM 5 and 6.

    I guess if I stick with SQL CE 3.1 then I can do the full development of WM5/6 code SQL right from the VS 2005 environment.

    But if I want to go with SQL CE 3.5, then I am no longer in a position to make use of the SQL server explorer tools in VS 2005….but I will have to install SQL Managament Studio to help me with the CE 3.5 database creation, table creation and other SQL related stuff with the Management Studio which happens to be a freebie…

    Am I correct?

    somebody please either confirm thsi or point me to somewhere I can get more info on this issue.

  23. Mahantesh.C.A says:

    Hi all,

     I have a doubt that, when we install windows setup file in clients machine where will be the database installed? I mean I have included the .sdf file in prerequisities.

    Thanks in advance.

Skip to main content