locked
Component migration to compact framework RRS feed

  • Question

  • Hi all!

    I have a component designed for the .net framework (could be added to the toolbox in VS 2005).
    I'm now trying to use my class in the compact framework. I get compile errors for all my design time attributes like; [BrowsableAttribute(false)], [Category("MyTab"), Description("Used to ...")].

    How to solve this?
    Is some other teqnique used for design attributes in the compact framework (why)?
    Please give me some example...

    The second question is how to make the component visible in the toolbox for both a WindowsApplication and a DeviceApplication project? (Maybe it will, if I get rid of my attribute errors...)

    /Mats

    Sunday, October 8, 2006 9:51 AM

Answers

  • You should remove them (or add conditional compilation to exclude them from device project). You need to use another way:

     

    http://symbian.sys-con.com/read/113332.htm

    http://blogs.msdn.com/vsdteam/archive/2005/07/20/Amit_Chopra.aspx

    http://blogs.msdn.com/xinyan/

     

    Not sure you can use same control on both NETCF and desktop.

    Sunday, October 8, 2006 5:17 PM
  • That’s because Compact Framework is indeed just a subset of the full one and has no design time support to save space. If you create device custom control from scratch, you’ll find NETCF model just as easy as desktop’s.

    Porting is a bit more complicated as you’d need to redo your attributes, but attributes probably the least of your worries on that path anyway – you would have to deal with control size, orientation changes, API’s not available on NETCF – usual porting stuff.

    To distinguish between NETCF and desktop projects simply define macro of you choice in project’s properties (on “Build” page – look for “conditional compilation characters”). For example, type in “NETCF” in device project only and use something like this in your code:

    #ifndef NETCF

    // Desktop only stuff here…

    #endif

    Monday, October 9, 2006 4:31 PM

All replies

  • You should remove them (or add conditional compilation to exclude them from device project). You need to use another way:

     

    http://symbian.sys-con.com/read/113332.htm

    http://blogs.msdn.com/vsdteam/archive/2005/07/20/Amit_Chopra.aspx

    http://blogs.msdn.com/xinyan/

     

    Not sure you can use same control on both NETCF and desktop.

    Sunday, October 8, 2006 5:17 PM
  • Tanks!

    I will have a deeper look into this soon. But when looking at the links above it seems like quite much work just to add a simple attribute to a .net compact framework component (using the class diagrams...). Why has microsoft chosen to have a diffrent approach on the compact framework - I thought the compact framework was just a subset of the full framework... seems not like Microsoft... they usally make it easy for the developer...

    One question; How can I detect if I'm compiling a class for the compact or for the full framework? So that I can have a conditional compilation. (And exclude all my attributes for the compact compilation)

    Monday, October 9, 2006 6:48 AM
  • That’s because Compact Framework is indeed just a subset of the full one and has no design time support to save space. If you create device custom control from scratch, you’ll find NETCF model just as easy as desktop’s.

    Porting is a bit more complicated as you’d need to redo your attributes, but attributes probably the least of your worries on that path anyway – you would have to deal with control size, orientation changes, API’s not available on NETCF – usual porting stuff.

    To distinguish between NETCF and desktop projects simply define macro of you choice in project’s properties (on “Build” page – look for “conditional compilation characters”). For example, type in “NETCF” in device project only and use something like this in your code:

    #ifndef NETCF

    // Desktop only stuff here…

    #endif

    Monday, October 9, 2006 4:31 PM