« thoughts on open source software | Main | Smartphone videos »

March 02, 2004

Kyle Cordes' talk on the CF

A pretty decent overview of beginning development for the .NET compact framework but there are a few things I'd disagree with.

http://www.kylecordes.com/story-268-cf-wireless-sig.html

"VS.NET does not cooperate with building the same software for both CF and desktop .NET"
That definitly hasn't been the case for me. I have a CF dll, CF, exe, and full framework exe. Both the CF and full framework reference the CF dll.

"If you include both a desktop and CF project in the same “Solution”, and you build/run the desktop app, VS.NET will build and deploy (!) the CF project."
To change that you just need to modify the startup behavior and make sure that the dll is set to deploy to the same place as the consuming device.

"# You can’t run the same EXE/DLL on both the CF and desktop .NET
# … because you need to bind to the right core assemblies for each platform"

Yes, you can. See above.

"# You can’t run exactly the same source code on both
# … because you CF code will need to make a few P/Invoke calls specific to the CF
# … because a few lines of code you need for the desktop, won’t work on the CF"

This is true only if you P/Invoke in your application or do CF or full framework specific things. There is quite a bit overlap between the CF and full and as long as you stick to that you are good. That's why I split the core of my app out into a DLL and two exes. The dll is the exact same source, exact same binary.

SQL CE "allows only one connection (total across all databases and apps!) at a time"
Interesting, didn't know that. I'll have to test it out.

I need to check out this free installer, Kyle used it to build a PC based install for his CF application.

Posted by mikel at March 2, 2004 09:30 AM

Comments

Thanks for your comments!

Actually I was not sufficiently clear in the presentation I posted, about compiling the same project for both platforms. Your approach is excellent for sharing a "logic" assembly between a CF and a desktop project, I've done this also with fine results.

However, a thing I am also doing, is to compile the GUI of my application again either CF or Desktop (modulo a few IFDEFs), so that I can run the GUI itself on either the CF (for deployment) or the Desktop (for easier and faster development and debugging). This requires actually compiling the source file separately for each platform, because the compiling process binds it to the core .NET framework assemblies which are different for CF and Desktop. Even if all the method invocations are exactly the same, you can't take a DLL or EXE that references a WinForms class from CF and run it on Desktop, or vice versa. (Note that this DID work in a beta release of CF, though.)

Thanks for the tip on the build/run, I'll tinker with the settings and see if i can get the good results you did.

Regarding the P/Invoke, the particular calls I did were CF-specific, but it is true as you point out that there are a great many P/Invokable calls that work on both platforms.

Posted by: Kyle Cordes at March 2, 2004 10:22 AM

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?