views:

7339

answers:

10

Hi, I have developed windows mobile 6 professional application using targeted framework as .NET CF 3.5 and professional 6 SDK. Also created its SmartDeviceCab file. When I install it on device not having CF 3.5 it fails to run my application (because the device has .NET CF 2.0). Now I know that I must have NET CF 3.5 on the device where I want to run my app. How can I detect the current version of CF and install(if required) CF 3.5 from my cab setup. I have explored and gone through much on Setup.dll but its too old way and I didn't find way to run cab file from my Setup.dll. Please help me to find the solution. Would be grateful if link/sample code provided. More frustrating is, I never touched VC++.

I have gone through: http://stackoverflow.com/questions/686651/detecting-if-the-compact-framewok-is-installed-on-mobile-device and its links.

Shailesh K.

+1  A: 

In WM 6, I believe (it could have been WM 5), they disallowed running a cab from within another cab. The only way to do it all in one go is through an MSI from the desktop. There are MSDN samples on how to get that started.

What I do in my app is detect the .NET CF version in my cab. If they don't have the right one, I fail the install and tell the user to install from the desktop. It's not the greatest solution, but MS doesn't really give us a choice.

ageektrapped
Hi ageektrapped,Thanks for reply. You said that you are detecting the .NET CF version from your cab. Can you provide the way(code) you are detecting the .NET CF version and checking that is it right one or not? Thanks. Shailesh K :)
cooliPhoneGuy
I modified the code provided in this sample http://msdn.microsoft.com/en-us/library/aa446531.aspx#netcfdepl_topic3
ageektrapped
A: 

This is not really an answer to your question, but in a situation like this I would just deploy two CABs: my application and the .Net CF 3.5 CAB. It's not that hard to tell a customer/client to install your app, and if it doesn't work to then install the .Net cab.

MusiGenesis
A: 

Thanks for replies. Its really disappointing that MS has no straightforward solution for this. I would go with MusicGenesis for now. I can give user two cabs (1) MyApp.cab (2) NETCFv35.wm.armv4i.cab. But I wanted to know that "NETCFv35.wm.armv4i.cab" will work for all devices. I heard about different devices with different instruction sets like MISP, ARM etc. Will NETCFv35.wm.armv4i.cab work for all Windows Mobile 6 Professional (and higher 6.1, 6.5) or what I have to do to take care of other devices?

Shailesh K

cooliPhoneGuy
Michael Stum
A: 

Have you used any .NET 3.5-specific API's that would prevent you from targeting .NET 2.0 Framework? If not (or if it is very little), I would consider just targeting 2.0.

You may be surprised how easy it is to change the version of the Framework you are targeting (unfortunately you can't just go to the Properties of your Project node in the Solution Explorer like you can with other project types in Visual Studio). I would suggest making a new project targeting the 2.0 Framework and dropping all of your source code in, compile, and see how many errors you have. The hope is that in about 5-10 mins, you are done with a compiled and running app, with no more .NET Framework dependency issues.

In planning a mobile app that I hope to write, I have chosen to stick with .NET 2.0 because so many devices don't ship with 3.5 by default.

mkmurray
Hi mkmurray,Thanks for your reply. Yes, I have earlier tried it and it was working for me. But this is not the (permanent)solution, I think. In future if I need to develop app based on CF 3.5 then again I will stuck at this point. So I am looking for permanent solution which will help me in future WM deployment.Shailesh K.
cooliPhoneGuy
A: 

Checkout www.mobilepackager.com it has some of the feature that you are looking for

I could not find any option to install the .NET framework in MobilePackager. Also, it does not have multiple languages in the installer.
Adrian Grigore
+1  A: 

Now Windows Market Place is there, so we don't need to take care about required .NET CF versions. Windows Market Place will do the required. :)

cooliPhoneGuy
A: 

Very simple. It has a little C++ code, but you don't have to change it at all. It's simply a matter of creating a second smart device cab project containing the .NET cab file you want to install (3.5 in your case), and swapping the installation DLL for the one created from the C++ project included in the sample. You just add registry values that describe where the cab files you want to install are and you're golden. You don't need to detect what version of .NET they have installed, just throw it in there and it will install over the top of any existing installation. There is a full whitepaper that explains it in the sample, as well as source code. Just download the Windows Mobile 6 SDK and navigate to this directory on your computer after installing it. Open the document titled "MultiCab Whitepaper.doc" and follow the instructions.

C:\Program Files\Windows Mobile 6 SDK\Samples\Common\CPP\Win32\multicabinstall

I used this for my own project and it works SO well!

Dylan Vester
A: 

For this I used NSIS. It's been a few months since I wrote the install script, so some details should be fuzzy.

First I install .NET CF 3.5. I use the file NETCFSetupv35.msi which automatically will install the .NET CF 3.5 on the mobile device if it doesn't already exist. If .NET CF 3.5 already exists, it shows a dialog box saying it already exists (for us this was acceptable). You could find/write an application that would set a return value that can be read by ExecWait (http://nsis.sourceforge.net/Docs/Chapter4.html), and then only call the msi if .NET CF is not installed.

Then I have 8 cabs to install, 3 for SQL Server Compact 3.5 (required), and 4 for a software that we depend on (optional, depending on client), and 1 for our app. I followed this tutorial: http://nsis.sourceforge.net/NSIS_for_Smartphone. Wrote a section for each one, if you want readonly then add SectionIn 1 RO after the section. Then call CeAppMgr passing as argument each CAB.

chocojosh
A: 

Dylan Vester : Awesome, thats exactly what I was looking for! I needed to install the .NET CF 3.5 on WM 6.5 phones that come with .netcf 2.0. I put the .NET cab in my application cab, so the users downloa one cab that does it all, without Activesync or a PC...no more "MSI from the desktop" :)

taridzo
This should be a coimment on that answer, not another answer.
ctacke
A: 

We have used AirSetup for this as it lets you chain installs and works really well and fast.

http://windowsmobiledn.com/using-spb-airsetup-to-create-pocket-pc-installers/

Jeff Pigott