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 ToolsBecause 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 toolsIf 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 installedThe 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:
2a: Installing Smart Devices
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:
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 www.Microsoft.com/SQL/Editions/Compact/Downloads.mspx and you'll see several additional packages available.
2: Install SQL Server 2005 Compact Edition Embedded EngineThe 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.
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:
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:
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,
Steve