gplusplus

I have created a *.cab file for my pocketpc application. I have also successfully created a *.msi installer for the use of installing the application from a desktop pc and then via active sync it installs the app onto my smartphone. This all works perfectly!

I have one problem, i want the *.msi to check to see what version of framework is currently installed on the smartphone. If version 2.0 is not installed, I would like the *.msi to install framework 2.0 onto the smartphone, so the user does not have to go to microsoft's website, download the files and install it.

I have looked over this article and it doesnt help me at all.
MSDN Link


Please help me with this situation if possible.

Thanks in advance.





Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

Ilya Tumanov

Common practice is to just install NETCF CABs the very same way as your own CAB ¨C as described in the article you¡¯ve mentioned.

That can be done by adding NETCF CABs to the MSI, adding another INI file and calling CeAppMgr twice ¨C NETCF INI first, your application INI next.

CAB file itself would check if newer version of NETCF is already installed so you don¡¯t have to.

It can be done via RAPI but RAPI can be disabled on some devices.






Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

gplusplus

Ok thats what I was going to try and do. So should I put all the CABs in the msi or just the CABs for the arm processor.... If I put all the CABs in there will it be able to decide which ones it needs to install by itself too






Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

Ilya Tumanov

If you're planning to support all the processors and OS then put all the CABs. If you're planning to support only ARM processor then put just ARM. There are 4 ¡°just¡± ARM CABs, by the way: PPC 2003, WM 5.0, CE 4.5 and CE 5. You probably need PPC 2003 and WM 5.0 CABs (unless your customer asked you to develop for specific Windows CE device).

Anyway, all you have to do is to list CABs for different processors in the INI and CeAppMgr.exe would pick the correct one for you based on connected device. You could read about that feature on MSDN.






Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

gplusplus

Thanks again for your quick response i appreciate it.

Here is my before install method where at the bottom i try and run the app manager twice.
For some reason it only installs the framework and skips my app.

I have two seperate INI files and i have added the "NETCFv2.wm.armv4i.cab" and both INIs to my MSI.

Do I have to make a seperate custom installer for each install One for the framework and one for the application

Code Snippet


void CustomInstaller_BeforeInstall(object sender, InstallEventArgs e)
{
// Find the location where the application will be installed
string installPath = GetAppInstallDirectory();
// Create the target directory
Directory.CreateDirectory(installPath);
// Copy your application files to the directory
foreach (string installFile in Directory.GetFiles(TEMP_PATH))
{
File.Copy(installFile, Path.Combine(installPath,
Path.GetFileName(installFile)), true);
}
// Get the path to ceappmgr.exe
RegistryKey keyAppMgr =
Registry.LocalMachine.OpenSubKey(CEAPPMGR_PATH);
string appMgrPath = (string)keyAppMgr.GetValue(null);
keyAppMgr.Close();

// Run CeAppMgr.exe to install the .net framework if needed onto the device
System.Diagnostics.Process.Start(appMgrPath,
"\"" + Path.Combine(installPath, CEAPPMGR_INI_FILE_FRAMEWORK_SETUP) + "\"");


// Run CeAppMgr.exe to install the files for nelson to the device
System.Diagnostics.Process.Start(appMgrPath,
"\"" + Path.Combine(installPath, CEAPPMGR_INI_FILE_NELSON_SETUP) + "\"");
}






Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

Ilya Tumanov

No, one installer should do. Consider waiting for previous installation to complete before starting next one. Or, better yet, register INIs with CeAppMgr and then install them in one step. See MSDN on how to do that.






Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

gplusplus

I changed the last lines of the method to this:

Code Snippet

// Register with ceAppMgr
System.Diagnostics.Process.Start(appMgrPath, "/register \"" + Path.Combine(

installPath, CEAPPMGR_INI_FILE_FRAMEWORK_SETUP) + "\" \"" + Path.Combine(installPath, CEAPPMGR_INI_FILE_NELSON_SETUP) + "\"");
// Run ceAppMgr
System.Diagnostics.Process.Start(appMgrPath);



And it appears to be working with no problem now. Thanks for your help I appreciate it so much.




Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

gplusplus

Any reason why the msi would work perfectly 3 times out of 5




Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

Ilya Tumanov

You should make sure first process completed and exited before spawning second one.






Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

gplusplus

Is the correct way of doing so

Code Snippet

Process proc = System.Diagnostics.Process.Start(appMgrPath,
"/register \"" + Path.Combine(installPath, CEAPPMGR_INI_FILE_FRAMEWORK_SETUP) + "\" \"" + Path.Combine(installPath, CEAPPMGR_INI_FILE_NELSON_SETUP) + "\"");

while (!proc.HasExited)

{ // Wait for termination }

// Run ceAppMgr
System.Diagnostics.Process.Start(appMgrPath);







Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

Ilya Tumanov

No, that would be a tight loop which would cause 100% CPU load. Use Process.WaitForExit() instead.






Re: Smart Devices VB and C# Projects Redistribution of .net framework 2.0

gplusplus

Awesome, it appears to be working again. I'm gonna continue testing it, hopefully that solves the problem.

Again, I appreciate your time and consideration to my questions.