title: How can I determine the version of the Compact Framework that is installed on my device?
body: <p>It looks like <a href="http://msdn.microsoft.com/en-us/library/d5cd9b2c%28v=vs.90%29.aspx" rel="nofollow noreferrer">this</a> has a solution to my recent hand-wringing and head-ringing in trying to sort out different versions of CF on various devices so that they will all run my 
  CE/CF app. These writhings can be read about <a href="https://stackoverflow.com/questions/23251972/why-is-my-ce-app-refusing-to-run">here</a> and <a href="https://stackoverflow.com/questions/23304832/how-can-i-install-cf-2-0-on-my-handheld-device-and-which-version-architecture">here</a>.</p>
  
  <p>That link shows a way to get an app built for an older version of the CF to run on a device which has a newer version installed. But it says: </p>
  
  <p><em>"To determine the currently installed version
  On the Pocket PC, use File Explorer to navigate to the \Windows directory and tap the cgacutil file.
  A message box appears with the version of the .NET Compact Framework installed on the device."</em></p>
  
  <p>However, Windows Explorer (there is no "File Explorer" on my Motorola 3190 device) shows no "cgacutil" in the Windows folder. The file denizens of the folder go from "ceconfig" to "charset" with no "cg*" between them.</p>
  
  <p>The URL linked to above also says:</p>
  
  <p><em>"To set an application to run on version 3.5
  Determine the version number of the .NET Compact Framework running on the device."</em></p>
  
  <p>How can I determine that? Once I know, I can supposedly add a file with the following data named [appName].exe.config to the handheld device and all will be rainbow stew/big rock candy mountain:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;runtime&gt;
        &lt;compatibilityversion major="2" minor="0"/&gt;
    &lt;/runtime&gt;  
    &lt;startup&gt;
        &lt;supportedRuntime version="v3.5.7000"/&gt;  // &lt;= what value should this be/what is on my device?
    &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>But the "v3.5.7000" should in actuality be what? I need to know how to determine that version value.</p>
  
  <p>In System Properties, I can see some OS info, but not the CF version. For instance, I see:</p>
  
  <p><strong>MS Windows CE Version 6.00</strong></p>
  
  <h2>UPDATE</h2>
  
  <p>Poking around, I noticed that there is a file on the device named "Microsoft .NET CF 2.0.LOG.TXT"</p>
  
  <p>The filename indicates the CF version installed IS 2.0</p>
  
  <p>So, since the .exe that works on the other device seems to be CF 1, can I use this as the contents of the [appName].exe.config file (content inside the file is more specific as to the version number):</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;runtime&gt;
        &lt;compatibilityversion major="1" minor="0"/&gt;
    &lt;/runtime&gt;  
    &lt;startup&gt;
        &lt;supportedRuntime version="v2.0.7045.00"/&gt;  
    &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Will that help?</p>
  
  <h2>UPDATE 2</h2>
  
  <p>The file "Microsoft .NET CF 2.0.LOG file contains some interesting info:</p>
  
  <pre><code>25/04/2014 16:50:32: Entered Install_Init().
      First Call: Yes
      Previously Installed: No
      Installation folder is: '\Windows'.
  25/04/2014 16:50:32: Build 2.0.7045.00 created on Feb 13 2007 at 22:23:41
  25/04/2014 16:50:32: Device CPU: 'ARMV4I', 05020000 (84017152)
  25/04/2014 16:50:32: MOTOROLA WinCE 6.00
  25/04/2014 16:50:32: AKU string : ''
  25/04/2014 16:50:32: OEM info   : 'MOTOROLA MC3100R'
  25/04/2014 16:50:32: Our trust level is: 2
  . . .
  25/04/2014 16:50:32: Invoker's command line: '/noui \Windows\NETCFV2.wce5.armv4i.cab'
  25/04/2014 16:50:32: Memory status, K --------------------------
  25/04/2014 16:50:32:   Load           : 35
  25/04/2014 16:50:32:   Physical       : 55616
  25/04/2014 16:50:32:   Physical free  : 36440
  25/04/2014 16:50:32:   Virtual        : 1048576
  25/04/2014 16:50:32:   Virtual free   : 1047936
  25/04/2014 16:50:32: Storage status, K -------------------------
  25/04/2014 16:50:32:   Available to us: 17020
  25/04/2014 16:50:32:   Total storage  : 30080
  25/04/2014 16:50:32:   Available total: 17020
  25/04/2014 16:50:32: -------------------------------------------
  25/04/2014 16:50:32: About to process registry.
  25/04/2014 16:50:32: Opened CF registry key OK. 
  25/04/2014 16:50:32: Looking for upgradeable installations for version '2.0.7045.00'
  25/04/2014 16:50:32: Got version value '3.5.7338.00'
  25/04/2014 16:50:32: Side by side version '3.5.7338.00' found and skipped.
  25/04/2014 16:50:32: Added new CF version value '2.0.7045.00'.
  25/04/2014 16:50:32: CF registry key closed.
  25/04/2014 16:50:36: Entered Install_Exit().
      Failed Dirs: 0
      Failed Files: 0
      Failed RegKeys: 0
      Failed RegVals: 0
      Failed Shortcuts: 0
  . . .
  25/04/2014 16:50:36: Processing alternative file: '\Windows\.NET CF 2.0\cgacutil.exe.-500~-500~ARMV4I'.
  25/04/2014 16:50:36: Special file extension: '.-500~-500~ARMV4I'.
  25/04/2014 16:50:36: File is intended for OS: -500 to -500, CPU: ARMV4I
  25/04/2014 16:50:36: Device CPU: 'ARMV4I', 05020000 (84017152)
  25/04/2014 16:50:36: CPU matches.
  25/04/2014 16:50:36: Version MIN ignored.
  25/04/2014 16:50:36: Version MAX ignored.
  25/04/2014 16:50:36: Querying version of file '\Windows\.NET CF 2.0\cgacutil.exe.-500~-500~ARMV4I'.
  25/04/2014 16:50:36: Version determined to be: 2.0.7045.0.
  25/04/2014 16:50:36: Get version completed.
  25/04/2014 16:50:36: Querying version of file '\Windows\cgacutil.exe'.
  25/04/2014 16:50:36: Version determined to be: 3.5.7283.0.
  25/04/2014 16:50:36: Get version completed.
  25/04/2014 16:50:36: Suggestion: do not overwrite.
  25/04/2014 16:50:36: Delete file '\Windows\.NET CF 2.0\cgacutil.exe.-500~-500~ARMV4I': done.
  25/04/2014 16:50:36: Processing alternative file: '\Windows\.NET CF 2.0\mscoree.dll.-500~-500~ARMV4I'.
  . . .
  25/04/2014 16:50:36: Adding file 'mscorlib.dll': added.
  25/04/2014 16:50:36: Adding file 'system.dll': added.
  25/04/2014 16:50:36: Adding file 'system.drawing.dll': added.
  25/04/2014 16:50:36: Adding file 'system.messaging.dll': added.
  25/04/2014 16:50:36: Adding file 'system.web.services.dll': added.
  25/04/2014 16:50:36: Adding file 'system.windows.forms.dll': added.
  25/04/2014 16:50:36: Adding file 'system.windows.forms.datagrid.dll': added.
  25/04/2014 16:50:36: Adding file 'system.xml.dll': added.
  25/04/2014 16:50:36: Adding file 'system.net.irda.dll': added.
  25/04/2014 16:50:36: Adding file 'system.data.dll': added.
  25/04/2014 16:50:36: Adding file 'microsoft.visualbasic.dll': added.
  25/04/2014 16:50:36: Adding file 'microsoft.windowsce.forms.dll': added.
  25/04/2014 16:50:36: Adding file 'Microsoft.WindowsMobile.DirectX.dll': added.
  25/04/2014 16:50:36: Adding file 'CustomMarshalers.dll': added
  </code></pre>
  
  <p>So the new device has both version 2.0.7045.0 and version 3.5.7283.0 installed.</p>
  
  <p>The old device, according to what is displayed when Windows\cgacutil.exe is run, has 1.0.3316.00 installed.</p>
  
  <p>The problematic project in question has Framework Version set to "v2.0"</p>
  
  <p>The legacy runs on the old device, but not on the new...???</p>
  
  <p>New builds of the source run on neither one. Since it targets Framework Version 2.0, I understand now why the new build won't run on the old device. But why not on the new one? It has CF 2 installed, which corresponds to the Framework Version targeted by the project...</p>
  
  <h2>UPDATE 3</h2>
  
  <p>I copied the file [appName].exe.config to the handheld device, in the same folder as the .exe</p>
  
  <p>This is the newer (Motorola 3190) device, which supposedly has both CF version 2.* and 3.5* installed.</p>
  
  <p>Attempting to run the legacy (supposedly built for CF 1.0*) exe does, indeed, behave differently with the exe.config file there. Instead of an everlasting hourglass, I get:</p>
  
  <pre><code>**.NET CF Initialization Error**
  to run this application, you must first install one of the following versions of the .NET Compact Framework:
  v2.0.7045.00
  Contact your application publisher for instructions about obtaining the appropriate version of the .NET Compact Framework.
  </code></pre>
  
  <p>So it tells me to contact myself, which is not of much use.</p>
  
  <p>Why did the text file indicate I had v2.0.7045.00 installed, whereas this indicates that I don't have it installed?</p>
  
  <h2>UPDATE 4</h2>
  
  <p>It's really macabre/frustrating to me that the text file indicates version 2.* is installed on the device, yet trying to run the latest version there (which has "v2.0" as the "Framework Version" property) fails to run. Hourglasses without the bla.exe.config file, fails with the err msg above with it...?!?</p>
  
  <h2>UPDATE 5</h2>
  
  <p>I also copied over the latest build of the app (against Framework Version 2) to the older device (the one with Framework 1 installed). I added a [appName].exe.config there with the .exe with these contents:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;runtime&gt;
        &lt;compatibilityversion major="2" minor="0"/&gt;
  v2.0.7045.00
    &lt;/runtime&gt;  
    &lt;startup&gt;
        &lt;supportedRuntime version="1.0.3316.00"/&gt;  
    &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>...but attempting to run the .exe just results in a momentary hourglass - no err msg, but no joy, either.</p>
  
  <h2>UPDATE 6</h2>
  
  <p>Experimenting further, I took the project with the opposite problem (Framework Version was v3.5, would run on the newer device, but not on the older one), and edited its .csproj file, changing <code>&lt;TargetFrameworkVersion&gt;</code> from "v3.5" () to "v2.0" (I first tried changing it to "v1.0" but got an error msg: "<em>This project requires .NET Compact Framework v1.0, which is not installed on this machine.</em>" so changed it from "v1.0" to "v2.0"</p>
  
  <p>However, that didn't help - that build also does not run on the (older) handheld device...</p>
  
  <p>The err msg tells me, though, that I never before needed to create a Framework Version 1.0 build, as I don't even have that on my dev machine (yet I have previously built versions of our legacy app that did indeed run on both devices). So it seems the device itself has been "messed with" (a newer version of the Compact Framework has been replaced with an older version).</p>
  
  <h2>UPDATE 7</h2>
  
  <p><strong>Note:</strong> The small .exe/utility that runs on the newer device still does after changing Framework Version via the .csproj file from "v3.5" to "v2.0"</p>
  
  <h2>UPDATE 8</h2>
  
  <p>To further clarify (muddify?) what's going on:</p>
  
  <p>The 3090 Symbol Handheld device has CF version 1.0.3316.00 installed (according to Windows\cgacutil.exe)</p>
  
  <p>The 3190 Motorola Handheld device has no Windows\cgacutil.exe, but has a file that indicates both versions '2.0.7045.00' and '3.5.7338.00' of the Compact Framework are installed on it</p>
  
  <p>The last exe built on a now defunct machine / by a departed developer runs on the 3090 only. It targets CF Framework 1, presumably (since it runs on a device with that version of the CF installed)</p>
  
  <p>It is very odd that that is the case, because prior to his leaving we shared code via TFS, and I was able to run the results (.exe) of the combined code on the devices, and so was he.</p>
  
  <p>The Latest build from my source compiles/builds, but runs on neither the 3090 nor the 3190. It targets CF Framework Version 2.0</p>
  
  <p>A minimalistic utility I built runs on the 3190 only. It targets CF Framework Version 2.0</p>
  
  <p>Does all this give anybody a clue?</p>
  
  <h2>UPDATE 9</h2>
  
  <p>On <a href="http://www.christec.co.nz/blog/archives/113" rel="nofollow noreferrer">this site</a> referenced in IowaEric's answer below it says, "The .NET Compact Framework installs a utility called cgacutil.exe onto each device."</p>
  
  <p>I see that file (cgacutil.exe) on one device, but not the other.</p>
  
  <p>The link above also says, "On Pocket PC or Smartphone devices you can use the File Explorer "</p>
  
  <p>...but I also see no "File Explorer" app[let]; I have Windows Explorer...???</p>
  
  <h2>UPDATE 10</h2>
  
  <p>Aha! As mentioned in that link, it does work to go to Start > Run... > cgacutil. It tells me "...[3.5.7283.0, 2.0.7045.0]"</p>
  
  <p>(on the 3190; on the 3090 it says "1.0.3316.00")</p>
  
  <h2>UPDATE 11</h2>
  
  <p>So this is what I've been able to determine about what's on the devices:</p>
  
  <pre><code>OS (Windows CE) version of 3090 == 05.00.1400
  OS (Windows CE) version of 3190 == 06.00
  
  CF versions installed on the devices:
  Symbol 3090 == 1.0.3316.00
  Motorola 3190 == 2.0.7045.0 &amp; 3.5.7283.0
  
  CF Version chart:
  1.0.3316.0 == 1.0 SP2
  2.0.7045.0 == 2.0 SP2   
  </code></pre>