- NSIS Discussion
- Detect .NET Compact Framework using NSIS Script
Archive: Detect .NET Compact Framework using NSIS Script
Salimgbelim
6th July 2005 09:32 UTC
Detect .NET Compact Framework using NSIS Script
Hi guys,
Need some help regarding NSIS script to package my application.
Q-1.I want is to detect if .netcf(.NET Compact framework) is installed on device if not install
install the framework then install my application.
Q-2.I want to install appropriate Cab (ARM/ARM4/SH3 etc..)files depending on the device.setup should detect the Operating system of device and install cab's accordigly
Is it possible using NSIS? Have anyone done it before?
Regards
Salim
Afrow UK
6th July 2005 11:30 UTC
You should look on the NSIS Wiki
-Stu
Salimgbelim
6th July 2005 13:12 UTC
No Examples on Wiki
Wiki Haven't got any example for mobile! :( :hang:
jmycr
6th July 2005 14:57 UTC
EnumRegValue $1 HKLM SOFTWARE\Microsoft\.NETFramework 0
StrCmp $1 "" no_framework framework
no_framework:
InetLoad::load "http://dotnetfx.exe" "$INSTDIR\dotnetfx.exe"
Execwait '"$INSTDIR\dotnetfx.exe"'
framework:
Salimgbelim
6th July 2005 16:41 UTC
Thanks for the reply.
but,I think this code detects for .net compact framework on computer from where we are installing the system,but what i want is to check on device.
Is it possible to somehow run something on device prior to installing the application which can detect the framework and return true/false?
Regards
Salim
Afrow UK
6th July 2005 17:17 UTC
What kind of operating systems exist on the device? If it's just Windows, you can try the Detect Windows Version function which you'll find in the NSIS Manual under Useful Scripts.
-Stu
Salimgbelim
6th July 2005 17:29 UTC
i got Orange M2000 which runs pocket pc 2003 OS.well for pocket pc 2003 it comes with .netCF but say e.g i want to install my application on some device which runs pocket pc 2002 OS (which doesn't come with compact framework) so i need a way during installing the application to detect on device.
Regards
Salim
Afrow UK
7th July 2005 15:43 UTC
Can you access the registry regedit on there? There's probably some registry entries there that identify which OS it us. Otherwise there should be some API function which returns the OS name / version which you could call with the System plugin (but I can't help you with that!)
-Stu
Salimgbelim
7th July 2005 17:51 UTC
Yes I can access the registery settings in Pocket PC,but i don't know how to access the pocket pc registery from NSIS script? :(
Afrow UK
7th July 2005 18:14 UTC
ReadRegStr?
There are a lot of registry and INI file instructions in the NSIS manual.
-Stu
0ddJob
3rd August 2005 17:05 UTC
Taken the below from MSDN, any dieas how to do in NSIS script? Or any other ideas?
Detecting the Microsoft .NET Compact Framework
You will need to create a .dll which can be invoked as a custom action from the MSI file.
Begin by connecting to the device using CeRapiInitEx.
Use CeFindAllFiles to search the device's Windows directory for GAC_mscorlib_*.dll. If that is present, some flavor of the .NET Compact Framework is installed on the device.
Query the device registry and enum the values in HKLM\SOFTWARE\Microsoft\.NETCompactFramework. You should find registry keys which represent the build of NETCF that is present. (e.g. 1.0.2268.00:REG_DWORD:0). This version is created by all .cab installs and is included on all future ROM installs. It was missing from the initial ROM install of the RTM .NET Compact Framework, so if you do not find it, assume the value is 1.0.2268.0.
At this point you should know whether the .NET Compact Framework is present, and whether you need to deploy your own version to the device. If you also need to deploy the SQL CE files, you can use a similar mechanism of searching the Windows directory for the GAC'd libraries. The SQL install does not post its version to the registry, so the only way to know the build version would be to read the Win32 resources of the .dll. In the sample I have opted to always install the SQL .cabs if they are required. This should be safe, because CE installer will prevent an inadvertent downgrade of the SQL packages on the device. A similar approach could be taken with the .NET Compact Framework as well.
kichik
4th August 2005 18:24 UTC
To call CeFindAllFiles, use the System plug-in. To enumerate the registry, use EnumRegKey and EnumRegValue. There are some examples for enumeration in the Wiki.
BULLETUK
2nd October 2006 07:36 UTC
Has anybody got a solution for this? I've tried and tried to get CF.NET SP1 to be included in my NSIS script. But everytime it fails with the error:
"Application Manager cannot install this application on your mobile device due to an invalid setup file."
Please take a look at the attached script. Thanks for any assistance.
kichik
6th October 2006 16:29 UTC
Make sure the setup file fits the device you're trying to install it on. There is usually a different executable for each platform. The OS version might not fit as well...