I asked about this a few mos ago over in the CF forum, but I'm hoping there's a better solution someone (Erik?) knows about here.
Is there a "standard" deploy script for SQL Server CE on devices? There doesn't even seem to be one in the d/l from Microsoft. During development, Visual Studio handles the installation of SQL Server CE on the device but deploying it on a device that isn't partnered to a dev box seems to be a matter of "just copy the cab file over".
While I'm willing to do that if I have to, it raises some other questions. How do I know if it's already there? How do I know if what's there is a newer version or not (and if it is, how do I abort this step)? How do I make sure some other application hasn't installed it already? Do I really even need to worry this?
I can just have my installer tell ActiveSync to put it on the device, but without knowing the above I'm kind of nervous about it.It is probably a good idea to check the version installed. The most reliable way to do this is to check for the existance and file version information of the SQL CE dll files on the device. Assuming that your users have not installed to a storage card, this piece of code may be able to help you. I have used Opennetcf.org's SDF 2.1 for the fileversioninfo stuff:
Code Snippet
using System;
using System.Collections.Generic;
using System.Text;
namespace SQLVerCheck
{
public class SQLVerCheck
{
public static bool MustInstallCore(int requiredBuild)
{
bool mustInstall = false;
//Windows Mobile 6
if (System.Environment.OSVersion.Version.Major == 5 && System.Environment.OSVersion.Version.Minor > 1)
{
//SQL CE is installed in ROM in Windows Mobile 6
mustInstall = false;
}
else
{
//TODO get windir via PInvoke - see http://blogs.msdn.com/netcfteam/archive/2006/10/02/Platform-detection-III_3A00_-How-to-detect-a-touch-screen-on-Windows-CE-in-.NET-CF.aspx
if (System.IO.File.Exists(@."\windows\sqlceqp30.dll"))
{
OpenNETCF.Diagnostics.FileVersionInfo fi = OpenNETCF.Diagnostics.FileVersionInfo.GetVersionInfo(@."\windows\sqlceqp30.dll");
if (fi.FileBuildPart < requiredBuild)
{
mustInstall = true;
}
else if (fi.FileBuildPart >= requiredBuild)
{
mustInstall = false;
}
}
else
// Not trace, so we must install
{
mustInstall = true;
}
}
return mustInstall;
}
public static bool MustInstallReplication(string requiredBuild)
{
bool mustInstall = false;
//Windows Mobile 6
if (System.Environment.OSVersion.Version.Major == 5 && System.Environment.OSVersion.Version.Minor > 1)
{
//SQL CE is installed in ROM in Windows Mobile 6
mustInstall = false;
}
else
{
//TODO get windir via PInvoke - see http://blogs.msdn.com/netcfteam/archive/2006/10/02/Platform-detection-III_3A00_-How-to-detect-a-touch-screen-on-Windows-CE-in-.NET-CF.aspx
if (System.IO.File.Exists(@."\windows\sqlceoledb30.dll"))
{
OpenNETCF.Diagnostics.FileVersionInfo fi = OpenNETCF.Diagnostics.FileVersionInfo.GetVersionInfo(@."\windows\sqlceoledb30.dll");
if (fi.FileBuildPart < requiredBuild)
{
mustInstall = true;
}
else if (fi.FileBuildPart >= requiredBuild)
{
mustInstall = false;
}
}
else
// Not trace, so we must install
{
mustInstall = true;
}
}
return mustInstall;
}
}
}
Usage:
if (SQLVerCheck.MustInstallCore(5300))
{
// MessageBox.Show("Must install sqlce30.dev.ENU.ppc.wce4.armv4.cab");
Launch the install here!
}
|||Erik,
Thank you for the reply.
This helps with the version check once my app is deployed, but mostly I am concerned about installing it in the first place. Is there no "standard install" deployment script for getting SQL Server CE on the device? If I install it with my app, there is no "Remove Program" option on the desktop Control Panel specifically for it.
Also, since the code snippet would be run from the device, if SQLVerCheck() returns true, how would I launch the install of SQLServerCE from there?
Sorry, I'm pretty new at this. I appreciate the help. It's the difficult stuff I tend to get. The easy stuff you'd be amazed though.
TIA
|||No, there is no: "standard install" deployment script for getting SQL Server CE on the device, as there as some many options for distributing applications on Windows Mobile,but essenitally they all get installed by launching a cab file on the device. You could include my sample code in an autorun program on a storage card, or in a separate installer launched on the device. In order to launch a cab file, you can you wceload.exe, see http://msdn2.microsoft.com/en-us/library/ms933760.aspx
No comments:
Post a Comment