Windows Vista Tips

Windows Vista Tips > Newsgroups > ActiveSync > Error trying to create an install program

Reply
Thread Tools Display Modes

Error trying to create an install program

 
 
mws
Guest
Posts: n/a

 
      02-12-2009
The code below gives Error 1001 OnafterInstall -> Object reference not set
to an instance of an object. AnyIdeas why?

Thanks

namespace CustomInstallLibCS
{
[RunInstaller(true)]
public partial class CustomInstaller : Installer
{
public CustomInstaller()
{
InitializeComponent();
}
protected override void OnAfterInstall(IDictionary savedState)
{
string programName = "\"" + CEAppMgrExe + "\"";
string programArg = "\"" + IniFilePath + "\"";

//Messagebox.show(programName + " " + programArg);


Process.Start(programName, programArg);
base.OnAfterInstall(savedState);
}

const string _ceAppMgrRegistryPath =
@"software\Microsoft\CurrentVersion\App Paths\CEAppMgr.exe";
const string _iniFileName = "GroceryList35Cab.cab";
const string _filePrefix = @"file:\";


string CEAppMgrExe
{
get
{
RegistryKey subkey = null;
string exePath = null;
try
{
subkey =
Registry.LocalMachine.OpenSubKey(_ceAppMgrRegistry Path);
exePath = (string) subkey.GetValue("");
}
finally
{
if (subkey != null)
subkey.Close();
}
return exePath;

}
}

string IniFilePath
{
get
{
string installfolder =
Path.GetDirectoryName(Assembly.GetExecutingAssembl y().GetName().CodeBase);
string iniFilePath = Path.Combine(installfolder,
_iniFileName);

if (iniFilePath.StartsWith(_filePrefix))
{
int index = _filePrefix.Length;
iniFilePath = iniFilePath.Substring(index);

}
return iniFilePath;
}

}

 
Reply With Quote
 
 
 
 
mws
Guest
Posts: n/a

 
      02-12-2009
Ok, found the problems. I had some typeo's in the file names. Now it gets
through the install process but will not install on the phone. The phone is
connected..It starts the CEAppMgr.exe, but nothing gets installed at that
point. My ini file is correct. here is the ini. I have verified the cab file
is in the right directory.

Any Ideas?

[CEAppManager]
Version = 1.0
Component = GroceryList35

[GroceryList35]
Description = Grocery List For Mobile Phone
CabFiles = GroceryList35Cab.CAB




"mws" <> wrote in message
news:OAIpu$...
> The code below gives Error 1001 OnafterInstall -> Object reference not set
> to an instance of an object. AnyIdeas why?
>
> Thanks
>
> namespace CustomInstallLibCS
> {
> [RunInstaller(true)]
> public partial class CustomInstaller : Installer
> {
> public CustomInstaller()
> {
> InitializeComponent();
> }
> protected override void OnAfterInstall(IDictionary savedState)
> {
> string programName = "\"" + CEAppMgrExe + "\"";
> string programArg = "\"" + IniFilePath + "\"";
>
> //Messagebox.show(programName + " " + programArg);
>
>
> Process.Start(programName, programArg);
> base.OnAfterInstall(savedState);
> }
>
> const string _ceAppMgrRegistryPath =
> @"software\Microsoft\CurrentVersion\App Paths\CEAppMgr.exe";
> const string _iniFileName = "GroceryList35Cab.cab";
> const string _filePrefix = @"file:\";
>
>
> string CEAppMgrExe
> {
> get
> {
> RegistryKey subkey = null;
> string exePath = null;
> try
> {
> subkey =
> Registry.LocalMachine.OpenSubKey(_ceAppMgrRegistry Path);
> exePath = (string) subkey.GetValue("");
> }
> finally
> {
> if (subkey != null)
> subkey.Close();
> }
> return exePath;
>
> }
> }
>
> string IniFilePath
> {
> get
> {
> string installfolder =
> Path.GetDirectoryName(Assembly.GetExecutingAssembl y().GetName().CodeBase);
> string iniFilePath = Path.Combine(installfolder,
> _iniFileName);
>
> if (iniFilePath.StartsWith(_filePrefix))
> {
> int index = _filePrefix.Length;
> iniFilePath = iniFilePath.Substring(index);
>
> }
> return iniFilePath;
> }
>
> }
>


 
Reply With Quote
 
mws
Guest
Posts: n/a

 
      02-12-2009
Well, it now seems there is a problem in the process.start(program, args).
I can manually run CEAppManager.exe and pass the args in ' ' blocks and it
runs fine. I tried doing that in the installer inself but no luck

Any Ideas

Thanks
Mark

"mws" <> wrote in message
news:OAIpu$...
> The code below gives Error 1001 OnafterInstall -> Object reference not set
> to an instance of an object. AnyIdeas why?
>
> Thanks
>
> namespace CustomInstallLibCS
> {
> [RunInstaller(true)]
> public partial class CustomInstaller : Installer
> {
> public CustomInstaller()
> {
> InitializeComponent();
> }
> protected override void OnAfterInstall(IDictionary savedState)
> {
> string programName = "\"" + CEAppMgrExe + "\"";
> string programArg = "\"" + IniFilePath + "\"";
>
> //Messagebox.show(programName + " " + programArg);
>
>
> Process.Start(programName, programArg);
> base.OnAfterInstall(savedState);
> }
>
> const string _ceAppMgrRegistryPath =
> @"software\Microsoft\CurrentVersion\App Paths\CEAppMgr.exe";
> const string _iniFileName = "GroceryList35Cab.cab";
> const string _filePrefix = @"file:\";
>
>
> string CEAppMgrExe
> {
> get
> {
> RegistryKey subkey = null;
> string exePath = null;
> try
> {
> subkey =
> Registry.LocalMachine.OpenSubKey(_ceAppMgrRegistry Path);
> exePath = (string) subkey.GetValue("");
> }
> finally
> {
> if (subkey != null)
> subkey.Close();
> }
> return exePath;
>
> }
> }
>
> string IniFilePath
> {
> get
> {
> string installfolder =
> Path.GetDirectoryName(Assembly.GetExecutingAssembl y().GetName().CodeBase);
> string iniFilePath = Path.Combine(installfolder,
> _iniFileName);
>
> if (iniFilePath.StartsWith(_filePrefix))
> {
> int index = _filePrefix.Length;
> iniFilePath = iniFilePath.Substring(index);
>
> }
> return iniFilePath;
> }
>
> }
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Progam install with dual boot Ron Carr Windows Vista Installation 8 05-25-2007 02:50 AM
cloning laptop sata harddrive vista premium Mark Ryan Windows Vista Hardware 5 04-26-2007 06:44 PM
Vista won't boot, kernal issues Lt. Washburn Windows Vista Installation 3 03-30-2007 01:09 AM
RE: You CAN do a Clean Install with the Upgrade Version - NO XP instal Zoie Windows Vista Installation 2 02-01-2007 11:59 PM
RE: You CAN do a Clean Install with the Upgrade Version - NO XP instal mail Windows Vista Installation 2 01-31-2007 06:15 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59