Installing SQLce 2005 Tools for VS2005 SP1

 

Last week, I attempted to install the SQL Server 2005 Compact Edition Tools for Visual Studio 2005 Service Pack 1 and received the following error message:

The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch.

How did I work through this issue?  I did a repair on my Visual Studio 2005 [Team Suite] installation and then re-installed Visual Studio 2005 Service Pack 1.  After this, I attempted the SQLce VS tools install (SSCE31VSTools-ENU.exe) again.  Success!

Of course, performing a repair install on Visual Studio is something we would all rather avoid (and the SP1 re-install).  By the time I went to perform the install on a second dev box, I found a better way:

From the original Visual Studio installation media, locate the \WCU folder and install SQL Mobile from there.  After that is complete, retry the SQLce 2005 VS tools install. (credit to Amit Chopra from the Visual Studio for Devices team for the tip).  For more, check out this thread from the sqlce newsgroup in which fellow MVP Ginny Caughey answers questions.

If you want the download links for all the SQL Server Compact Edition 2005 bits, check out my prior blog post where I list all the downloads.

Visual Studio 2005 Service Pack 1 – released!

Visual Studio® 2005 Team Suite SP1
http://www.microsoft.com/downloads/info.aspx?na=22&p=1&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=&u=%2fdownloads%2fdetails.aspx%3fFamilyID%3dbb4a75ab-e2d4-4c96-b39d-37baf6b5b1dc%26DisplayLang%3den

Visual Studio® 2005 Team Foundation Server SP1
http://www.microsoft.com/downloads/info.aspx?na=22&p=2&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=&u=%2fdownloads%2fdetails.aspx%3fFamilyID%3da9ab638c-04d2-4aee-8ae8-9f00dd454ab8%26DisplayLang%3den

Visual Studio® 2005 Express Editions SP1
http://www.microsoft.com/downloads/info.aspx?na=22&p=3&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=&u=%2fdownloads%2fdetails.aspx%3fFamilyID%3d7b0b0339-613a-46e6-ab4d-080d4d4a8c4e%26DisplayLang%3den

A co-worker noted that you may need to follow the workaround detailed in KB925336 to get it to install successfully. (thanks, Matt!)

VS2008 Smart Device Development ReadMe items

2.3.1.7. Visual Studio 2008 does not recognize Windows Mobile 6 SDK when the SDK is already installed.

 

If a user installs Visual Studio 2008 on a computer that already has Windows Mobile 6 SDK, Visual Studio 2008 will not recognize the SDK. Repairing Windows Mobile 6 SDK will not solve this.

 

To resolve this issue:

 

1. Uninstall Windows Mobile 6 SDK.

2. Reinstall Windows Mobile 6 SDK.

 

2.3.1.8 SQL Server Compact 3.5 does not use the Encrypt property of the SqlCeConnection class.

The Encrypt property in the SqlCeConnection class should not be used. The property is retained in SQL Server Compact 3.5 only for backward compatibility.

To resolve this issue:

 

Use the encryption mode property of the SqlCeConnection class to encrypt SQL Server Compact 3.5 database files. Uses of encryption mode, together with code samples, are as follows.

1. To create a new encrypted SQL Server Compact 3.5 database.

SqlCeEngine engine = new SqlCeEngine(“Data Source=Northwind.sdf;encryption mode=platform default;Password=passw0rd;”);
engine.CreateDatabase();

2. To upgrade a SQL Server 2005 Compact Edition (version 3.1) or SQL Server 2005 Mobile Edition (version 3.0) database to an encrypted SQL Server Compact 3.5 database.

SqlCeEngine engine = new SqlCeEngine(“Data Source=Northwind.sdf;Password=passw0rd;”);
engine.Upgrade (“Data Source=Northwind.sdf;encryption mode=platform default;Password=passw0rd;”);

3. To change the encryption mode of an existing SQL Server Compact 3.5 database.

SqlCeEngine engine = new SqlCeEngine(“Data Source=Northwind.sdf;Password=passw0rd;”);
engine.Compact(“Data Source=Northwind.sdf;encryption mode=ppc2003 compatibility;Password=passw0rd;”);

4. To encrypt an unencrypted SQL Server Compact 3.5 database.

SqlCeEngine engine = new SqlCeEngine(“Data Source=Northwind.sdf”);
engine.Compact(“Data Source=Northwind.sdf;encryption mode=platform default;Password=passw0rd;”);

 

2.3.1.9. Design-time experience in Smart Device programs cannot be used when SSC 3.1 database is targeted.

A Smart Device programmer is unable to use any of the designer features, such as Add Datasource, Add New Connection, Create Database, Generate Data Forms, and drag-and-drop datasource objects onto the form designer, when she is programming against a SQL Server Compact Edition 3.1 database. The Smart device designer features default to SQL Server Compact 3.5 database.

To resolve this issue:

 

Use Visual Studio 2005 Service Pack 1 to program against SQL Server Compact Edition 3.1 database for Smart Device programs. For more information about using Visual Studio 2008 with SQL Server Compact Edition 3.1 database, see http://go.microsoft.com/fwlink/?LinkID=101885.

2.3.1.10. During the upgrade of a Visual Studio 2005 project to Visual Studio 2008, the encrypted SQL Server Compact database is not upgraded, and ClickOnce applications must be re-published.

 

Database files (*.sdf) that are created by earlier version of SQL Server Compact are not compatible with SQL Server Compact 3.5. Un-encrypted database files from earlier versions of SQL Server Compact are upgraded when a Visual Studio 2005 project is upgraded in Visual Studio 2008. Encrypted database files must be manually upgraded. If the Visual Studio 2005 project uses ClickOnce to publish applications, the application should be re-published after the project has been upgraded in Visual Studio 2008.

 

To resolve this issue:

Upgrade the encrypted database files by completing the following steps.

1. Click Data.
2. Click Add New Data Source.
3. Click Add Connection. If an earlier version of the database file is open, a message appears. If you click OK, the Upgrade to SQL Server Compact 3.5 Database dialog box appears.

Alternatively the SqlCeEngine.Upgrade API can be used for programmatic scenarios, as shown in the following code example.

SqlCeEngine engine = new SqlCeEngine(“Data Source=Northwind.sdf;Password=passw0rd;”);
engine.Upgrade (“Data Source=Northwind.sdf;encryption mode=platform default;Password=passw0rd;”);

If the project uses ClickOnce to publish applications, the application should be re-published after it has been upgraded in Visual Studio 2008. When you re-publish the Click Once application in Visual Studio 2008, you may see a warning that SQL Server 2005 Compact Edition prerequisite cannot be found for bootstrapping. You can ignore the warning.

 

2.3.1.11. SQL Server Compact 3.5 data types for parameters such as SqlDbType or DbType should be explicitly set.

 

If the data types for parameters such as SqlDbType or DbType are not explicitly set, an exception will be thrown.

 

To resolve this issue:

 

Explicitly set the data type for parameters such as SqlDbType or DbType. Doing this is critical in case of BLOB data types (image and ntext). A code example follows.

SqlCeEngine engine = new SqlCeEngine(connString);
engine.CreateDatabase();
engine.Dispose();
SqlCeConnection conn = new SqlCeConnection(connString);
conn.Open();
SqlCeCommand cmd = conn.CreateCommand();
cmd.CommandText = “CREATE TABLE BlobTable(name nvarchar(128), blob ntext);”;
cmd.ExecuteNonQuery();
cmd.CommandText = “INSERT INTO BlobTable(name, blob) VALUES (@name, @blob);”;
SqlCeParameter paramName = cmd.Parameters.Add(“name”, SqlDbType.NVarChar, 128);
SqlCeParameter paramBlob = cmd.Parameters.Add(“blob”, SqlDbType.NText);
paramName.Value = “Name1″;
paramBlob.Value = “Name1″.PadLeft(4001);
cmd.ExecuteNonQuery();

 

2.3.2. ADO.NET

2.3.2.1. After Visual Studio 2008 is upgraded, a warning is displayed that a MDAC 2.8 prerequisite is missing or that a built application does not run on Windows 2000 after it is installed.

 

You may encounter one of the following problems:

- A Visual Studio 2005 project was upgraded to Visual Studio 2008, and now a build warning says that a prerequisite is missing.

- A built application that depends on MDAC does not run on Windows 2000.

- Windows 2000 users cannot run a ClickOnce application because MDAC is missing.

 

To resolve this issue:

 

- If you do not require MDAC and you are getting a build warning, open the Prerequisites dialog box and then clear the MDAC prerequisite.

- If you are targeting Windows 2000 clients and require the MDAC prerequisite, get the Bootstrapper package from the Internet, as follows.

1. Open the Prerequisites dialog box and then click ‘Check Microsoft Update for more redistributable components’. Doing this will open http://go.microsoft.com/fwlink/?linkid=40981.

2. On the Web page, download the MDAC Bootstrapper package and save it in a new folder in \Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\.

- Get the Bootstrapper package from Visual Studio 2005.

1. If Visual Studio 2005 is installed on the same computer, you can copy the MDAC28 folder in \Program Files Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\ and then paste it in \Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\.

A good week…

Some of my readers my wonder where I’ve been the last week or two as there has been no TMM  and I have, as they say, “gone ghost”.  Well, gentle readers, between working on some internal Avanade stuff, tending to some personal matters, and being in training in Chicago last week, I’ve been fairly busy.

Last week though, outside of a great deal of difficulty in getting to and from Chicago due to weather in the midwest, was a great week.  Let’s review:

  • I received a notice that my SlingBox had arrived at my house (more on my experiences with the SlingBox later)
  • I was in training, an internal course called Principles of Architecture II.  I got to see some old friends and make some new ones. This is a week-long course covering software and infrastructure architecture for senior folks.  During the week, there is a competition revolving around a scenario received on Monday.  Teams present incremental items during the week, and give a presentation that incorporates those items plus others on Friday.  I’m happy to say that my team won – we put forth a good deal of effort and it paid off.  Doug, Manohar, Vic and Phil – you guys rock. :-)
    • I was in Chicago. :)   Had some good times and great food.
  • I was confirmed for on a very large and important project on the east coast that I start on Monday. I hope I’m able to talk about this a bit…we’ll see.

    ….and

  • I have been named as a .NET Compact Framework MVP.  Sincere thanks to my nominator and to the folks at Microsoft. I am honored. 

That’s the best week I’ve had in a long time.  I had a really good weekend as well; I spent most of it outside doing landscaping and such in 50F degree weather.

What’s in my pipeline now:

  • [obviously] Starting the project I mentioned earlier
  • Working on something on the side I call “Project Fountainhead”.  This project was born out of pain that I have experienced in the past on Windows CE / Windows Mobile projects, and experienced this rather acutely while working on the ACA Devices asset for Avanade.  I’d like to distribute this publicly, but I’ll need to go through legal channels at Avanade, I think. 
  • Work on my blog.. lots of small stuff to do. Still hunting a great skin, and I have some other UI stuff to do.   I’m also fleshing out further ideas for things to blog about.
  • Getting deep with VSTS
  • Getting deep with MBAT
  • Writing
  • Work on upgrading my MCSD (.NET) to MCPD.

-Nino

The Mobile Minute 125

Last TMM post of 2005…  Happy New Year! :-)

If you have not yet signed up for the Dayton-Cincinnati Code Camp  on January 21,2006…. do it now!

Software / Hardware 

 Development

In Other News . . .

  • HTC now has a US website (via msmobiles.com)
  • Check out this BetaNews piece on T-Mobile 2006 expansion plans (more 850MHz action!) All I want (ok, one thing) from T-Mobile is an EDGE vs GPRS coverage map.  Decent customer service would be another (I don’t know which is worse, their in-store or on-the-phone customer service).. [sigh].

-Nino

It’s the emulator, stupid!!!

 

Just a quick reminder to anyone who’s been hip-deep in Whidbey/Windows Mobile 5: when you go to deploy a [legacy] VS2003/WM2003 app to WM2003 emulator, you need to pick the x86 CAB …  DOH!

I spent twenty minutes trying to figure out why my CAB wouldn’t install on the emulator (I even re-wrote the .inf file – I got pretty handy at that after my project in D.C.)… only to have it dawn on me that I was picking the wrong CAB.  The WM2003 emulator runs an x86 version..not ARM (or ARMV4).   The only emulator that is a true ARM emulator is the one from the Windows Mobile 5.0 SDKs.  

[sigh]…  that’s what I get for doing most of WM2003 development without the emulator [and instead deploying to the device].

Time for dinner…and a Guinness.

-Nino