using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Install; using Microsoft.Win32; using System.Reflection; using System.IO; using System.Diagnostics; using System.Windows.Forms; namespace WindowsControlLibrary1 { [RunInstaller(true)] public partial class CustomInstaller : Installer { public CustomInstaller() { InitializeComponent(); } protected override void OnAfterInstall(System.Collections.IDictionary savedState) { string programName = "\"" + CeAppMgrExe + "\""; string programArg = "\"" + IniFilePath + "\""; MessageBox.Show(programName + " " + programArg); Process.Start(programName, programArg); base.OnAfterInstall(savedState); } const string _ceAppMgRegistryPath = @"software\Microsoft\Windows\CurrentVersion\App Paths\CEAppMgr.exe"; const string _iniFileName = "PDARAM.ini"; const string _filePrefix = @"file:\"; string CeAppMgrExe { get { RegistryKey subKey = null; string exePath = null; try { subKey = Registry.LocalMachine.OpenSubKey(_ceAppMgRegistryPath); exePath = (string) subKey.GetValue(""); } finally { if (subKey != null) subKey.Close(); } return exePath; } } string IniFilePath { get { string installFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); string iniFilePath = Path.Combine(installFolder, _iniFileName); if (iniFilePath.StartsWith(_filePrefix)) { int index = _filePrefix.Length; iniFilePath = iniFilePath.Substring(index); } return iniFilePath; } } } }
Can anyonehelp me? I am buliding the Desktop installer, and it starts the install proccess, but tells me there is an error in my setup file? <b>This is my INI file</b> [CEAppManager] Version = 1.0 Componet = DeviceApplication1 [DeviceApplication1] Description =