fragte ich diese gleiche Frage eine Weile zurück: How to Auto-Update Windows Mobile application
Grundsätzlich benötigen Sie zwei Anwendungen.
App1: Startet die eigentliche Anwendung, prüft aber auch auf eine CAB-Datei (Installer). Wenn die CAB-Datei vorhanden ist, wird die CAB-Datei ausgeführt.
App2: Tatsächliche Anwendung. Es ruft einen Webdienst auf, übergibt eine Versionsnummer an den Dienst und ruft eine URL zurück, wenn eine neue Version existiert(). Nach dem Herunterladen können Sie optional die CAB-Datei installieren und herunterfahren.
Ein potentielles Problem: Wenn Sie Dateien haben, die eine Installation auf das Dateisystem stellt, aber nicht überschreiben kann (Datenbankdatei, Protokoll usw.), benötigen Sie zwei separate Installationen.
Um ein Taxi zu installieren: aufblicken wceload.exe http://msdn.microsoft.com/en-us/library/bb158700.aspx
private static bool LaunchInstaller(string cabFile)
{
// Info on WceLoad.exe
//http://msdn.microsoft.com/en-us/library/bb158700.aspx
const string installerExe = "\\windows\\wceload.exe";
const string processOptions = "";
try
{
ProcessStartInfo processInfo = new ProcessStartInfo();
processInfo.FileName = installerExe;
processInfo.Arguments = processOptions + " \"" + cabFile + "\"";
var process = Process.Start(processInfo);
if (process != null)
{
process.WaitForExit();
}
return InstallationSuccessCheck(cabFile);
}
catch (Exception e)
{
MessageBox.Show("Sorry, for some reason this installation failed.\n" + e.Message);
Console.WriteLine(e);
throw;
}
}
private static bool InstallationSuccessCheck(string cabFile)
{
if (File.Exists(cabFile))
{
MessageBox.Show("Something in the install went wrong. Please contact support.");
return false;
}
return true;
}
die Versionsnummer zu erhalten. Assembly.GetExecutingAssembly() GetName() Version..(ToString)
Um ein Taxi herunterladen:
public void DownloadUpdatedVersion(string updateUrl)
{
var request = WebRequest.Create(updateUrl);
request.Credentials = CredentialCache.DefaultCredentials;
var response = request.GetResponse();
try
{
var dataStream = response.GetResponseStream();
string fileName = GetFileName();
var fileStream = new FileStream(fileName, FileMode.CreateNew);
ReadWriteStream(dataStream, fileStream);
}
finally
{
response.Close();
}
}
Ich beziehe mich auf beide tatsächlich. http://msdn.microsoft.com/en-us/library/aa446487.aspx dies tut beides, aber es ist ein alter Artikel und ich fragte mich nur, ob jemand praktische Erfahrung damit hatte. – sarsnake