Installing CF app on a desktop or server

M

Michael Ray

I'm new to both .Net and subsequently CF development. The app I'm
creating will run on a Win CE 4.2 unit on forklifts to access a database
to handle the orders for the plant. Screen resolution is 800x600 with
Intel XScale processor. None of the emulators in VS 2008 or the Mobile 6
SDK (why isn't that included???) support that resolution so I want to
test installing and running it on a desktop instead. This brings me to a
couple issues so far:

1. I can't seem to load what I'd think would be the appropriate CF,
NETCFv2.wce4.x86.cab. Is there some special way to do this? The
netcflaunch.exe doesn't work on Win32 apparently. I'm testing it on a
clean install of XP SP 2 with no Framework installed.

2. Another issue is we'd like to run this app from a server. It appears
that that cannot be done because of the security permissions for one.
That's when I came to the realization that the .Net SDKs (with the nifty
tools such as mscorcfg.msc that will supposedly solve this issue) also
aren't included with VS 2008 Professional (?!?!?). So I downloaded the
new 1.3 GB SDK last night.

3. Is there a simple way to convert back and forth between a Smart
Device WinForm project and a normal WinForm one? I ended up recreating
the form all over and cutting and pasting the code.

I must say this has been quite the learning experience. :) If it were a
"normal" mobile app, it wouldn't be too bad.
 
C

Chris Tacke, eMVP

1. I can't seem to load what I'd think would be the appropriate CF,
NETCFv2.wce4.x86.cab. Is there some special way to do this? The
netcflaunch.exe doesn't work on Win32 apparently. I'm testing it on a
clean install of XP SP 2 with no Framework installed.

You can't install the CF on a non-Windows CE device (like a desktop PC
running XP or Vista). There are several reasons for this - like the fact
that the CF engine would try calling Windows CE functions that don't exist
or that exists in different locations (e.g. coredll v. kernel32).

CF assemblies are retargetable, meaning they will just run under the full
framework. If you're not using any device-specific functionality in your
app (unlikely but possible) then just run the binary and it will behave.
2. Another issue is we'd like to run this app from a server. It appears
that that cannot be done because of the security permissions for one.
That's when I came to the realization that the .Net SDKs (with the nifty
tools such as mscorcfg.msc that will supposedly solve this issue) also
aren't included with VS 2008 Professional (?!?!?). So I downloaded the new
1.3 GB SDK last night.

I don't understand exactly what you're asking. By "server" do you mean you
want to run it on a PC with a Windows Server OS (2003, 2008)? If so, see #1
above. If you mean a CE device acting as a server then the CF has no code
security in it at all, so there's nothing you have to do to make it work.
3. Is there a simple way to convert back and forth between a Smart Device
WinForm project and a normal WinForm one? I ended up recreating the form
all over and cutting and pasting the code.

Create an empty project of each and have them share all of the source files.
No copy/paste needed.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
 
M

Michael Ray

You can't install the CF on a non-Windows CE device (like a desktop PC
running XP or Vista). There are several reasons for this - like the fact
that the CF engine would try calling Windows CE functions that don't exist
or that exists in different locations (e.g. coredll v. kernel32).

CF assemblies are retargetable, meaning they will just run under the full
framework. If you're not using any device-specific functionality in your
app (unlikely but possible) then just run the binary and it will behave.

I had figured it would work with the full framework. I'm not doing
anything with the device so it does work fine. This app just hits a
database for the operator to see open orders and indicate their actions
regarding those orders.
I don't understand exactly what you're asking. By "server" do you mean you
want to run it on a PC with a Windows Server OS (2003, 2008)? If so, see #1
above. If you mean a CE device acting as a server then the CF has no code
security in it at all, so there's nothing you have to do to make it work.

I mean Novell server. I guess the device cannot map a non-Windows
server, but I'd think CE could map a Windows network drive like XP can.
I assume as long as the device has the CF, it shouldn't be an issue if
the exe is on a mapped drive. That brings up another stupid question I have:

Since these are old CE 4.2 units, how do I deploy CF 2.0 to them?
Create an empty project of each and have them share all of the source files.
No copy/paste needed.

That would be simple.
 
P

Paul G. Tobey [eMVP]

2. Another issue is we'd like to run this app from a server.
I mean Novell server. I guess the device cannot map a non-Windows server,
but I'd think CE could map a Windows network drive like XP can. I assume
as long as the device has the CF, it shouldn't be an issue if the exe is
on a mapped drive. That brings up another stupid question I have:

Well, sort of. Since there's no such thing as a drive letter, while you can
certainly connect to a network resource, at least if your target device has
the right components built into the OS, it doesn't look much like it does on
the desktop. All network shares that are mapped appear in \network, so you
might have something like \network\sharedfolder on myserver\program.exe as
the name of the application. You can't map Novell at all in Windows CE.
Since these are old CE 4.2 units, how do I deploy CF 2.0 to them?

Same way as with any other device that has .NET CF 1.0 in it. You can let
Visual Studio do it for you, or you can download the redistributable version
from the Web and install it.

Paul T.
 
M

Michael Ray

Paul said:
Same way as with any other device that has .NET CF 1.0 in it. You can let
Visual Studio do it for you, or you can download the redistributable version
from the Web and install it.

Since VS doesn't really know what the specific device is, I'm guessing I
just need to copy over the appropriate CAB file like I would the app CAB
file? I've just told VS it's a Mobile 6 device since that's the only one
that uses CF 2.0 (once I downloaded that SDK). I suppose in theory I
could "install" CF 2.0 on a PPC 2003 or Mobile 5 emulator to see how it
works.

When I run the project from VS, it always pukes because the config file
path doesn't follow the standard naming convention. I have to copy it
over to the emulator where it expects the exe to run. Is there a way
around that?

Thank you, Chris and Paul.
 
P

Paul G. Tobey [eMVP]

I'm not sure that I follow. You should be able to download the .NETCF 2.0
Redistributable from Microsoft, install that on the PC, connect the device
via ActiveSync and have it installed. Don't flutz around too much with
Windows Mobile. There is a significant amount of stuff in the Windows
Mobile framework that doesn't make sense for generic Windows CE.

Paul T.
 
M

Michael Ray

Create an empty project of each and have them share all of the source files.
No copy/paste needed.

I'm not following the 2 empty projects to start. The source files would
be in a third project?

What makes sense to me is that I would have the Smart Device Winform
project with the source files (since it's most restrictive) and then
have an empty winform project that links to those same files. All
editing would be done in the SD project to make sure it would still work
with the CF, but I could compile a new exe from the linked full
framework project.

Now that I think about this some more, I wouldn't gain anything from a
separate project because the SD project exe should run fine on either
the CF or full framework, right?
 
C

Chris Tacke, MVP

I'm not following the 2 empty projects to start. The source files would be
in a third project?

Nope. You'll have 2 projects. Which has links and which has files is
purely up to your taste.
What makes sense to me is that I would have the Smart Device Winform
project with the source files (since it's most restrictive) and then have
an empty winform project that links to those same files. All editing would
be done in the SD project to make sure it would still work with the CF,
but I could compile a new exe from the linked full framework project.

Yes and no. Often I have projects where the device assembly has some
device-specific stuff and the desktop assembly has it's own desktop-only
stuff. So it's a bit more complex. I typically use partial classes and
interfaces to navigate around this mess. So I might have a class Foo that
breaks out into 3 separate physical files like this:

Foo.cs <contains functionality core to all platforms>
Foo_Device.cs < contains device-specific pieces>
Now that I think about this some more, I wouldn't gain anything from a
separate project because the SD project exe should run fine on either the
CF or full framework, right?

In theory, but it's rare that I have anything that clean. As soon as you
need to P/Invoke you have a platform dependency (unless you do a fair bit of
work to make it run on either) or use any Win CE-specific stuff.

-Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top