locked
Custom MSI Deployment RRS feed

  • Question

  • i have created a custom MSI to install my mobile app and the compact framework 3.5.  but when i run the msi i get this error directly before the ceappmgr.exe for WMDC can start the install i get this error "application manager cannot install this application on your mobile device due to an invalid setup file".

    i have spent over a week working on diferent solutions and search bing and google and most of the information i find is for VS2005 nothing for VS2008 and most blog post are dated several years ago and nothing relating directly to what my issue is.

    any help would be greatly appreciated.

    here is the code to the customAction

    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Configuration.Install;
    using System.Diagnostics;
    using System.IO;
    using System.Reflection;
    using System.Windows.Forms;
    using Microsoft.Win32;

    namespace CMMBaseLib
    {
    [RunInstaller(true)]
    public partial class SaudInstaller : Installer
    {
    public SaudInstaller()
    {
    InitializeComponent();
    }

    const string _ceAppManagerRegistryPath =@"Software\microsoft\windows\currentversion\app paths\ceappmgr.exe";
    const string _iniFileName = "SAUD.ini";
    const string _iniNetCFFileName = "netcf35.ini";
    const string _filePrefix = @"file:\"; //file:///

    string CeAppManagerExe
    {
    get
    {
    RegistryKey localkey = null;
    string appPath = null;

    try
    {
    localkey = Registry.LocalMachine.OpenSubKey(_ceAppManagerRegistryPath);
    appPath = localkey.GetValue(null).ToString();
    }
    finally
    {
    if (localkey != null)
    localkey.Close();
    }

    return appPath;
    }
    }

    string IniFilePath
    {
    get {
    string localInstallFolder= Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
    string localiniFilePath = Path.Combine(localInstallFolder, _iniFileName);

    //wanna see exactly file prefix;
    //MessageBox.Show(localiniFilePath);
    //end

    if(localiniFilePath.StartsWith(_filePrefix))
    {
    int localLength = _filePrefix.Length;
    localiniFilePath=localiniFilePath.Substring(localLength);
    }

    return localiniFilePath;
    }
    }

    string IniNetCFFilePath
    {
    get
    {
    string localInstallFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
    string localiniFilePath = Path.Combine(localInstallFolder, _iniNetCFFileName);

    if (localiniFilePath.StartsWith(_filePrefix))
    {
    int localLength = _filePrefix.Length;
    localiniFilePath = localiniFilePath.Substring(localLength);
    }

    return localiniFilePath;
    }
    }

    protected override void OnAfterInstall(IDictionary savedState)
    {
    string localProgramName = "\"" + CeAppManagerExe + "\"";
    string localProgramArg = "\"" + IniNetCFFilePath + "\"";

    Process.Start(localProgramName, localProgramArg).WaitForExit();

    localProgramArg = "\"" + IniFilePath + "\"";
    Process.Start(localProgramName, localProgramArg).WaitForExit();

    base.OnAfterInstall(savedState);
    }

    }
    }

    This are the what ini Files look like

    [CEAppManager]
    Version        = 1.0
    Component    = NetCompactFramework35

    [NetCompactFramework35]
    Description    = Net Compact Framework35
    CabFiles    = NETCFv35.wm.armv4i.cab

     

    [CEAppManager]
    Version        = 1.0
    Component    = StretchAtYourDeskSetup

    [StretchAtYourDeskSetup]
    Description    = SAUD Mobile Application
    CabFiles    = SaudSetup.CAB


    Christian - developer
    Tuesday, June 8, 2010 2:41 PM

Answers