I was hoping it was as easy as referencing my existing libraries to use them with WP7. However, it complains about not able to load them because of .Net CF when I actually use them.
Do i need to recompile them to .NET CF or something?
I thought the big plus of WP7 was: leveraging your existing codebase...? How can I leverage my existing codebase if I 开发者_如何转开发need to strip everything out of it and maintain multiple versions?
Yes, you need to start up a windows phone library (which has references to the netcf bcl) ... you can add most all of your files as linked file references. This lets you change one source file and each platform will automatically be updated once you compile.
Look up some of XNA tutorials/videos that talk about how to have cross platform games for an example of how to do this
The .NET Compact Framework is a subset of the full .NET Framework with some additional niceties for mobile development. If you want to compile a library for Windows and Windows Phone, you need to build your code for each platform.
You can still leverage much of the same code you used for your .NET library, but you will need to use preprocessor symbols and conditional compilation to exclude functionality for the desktop (or phone) that is not supported in the other framework.
To do this: create two projects. One project will contain all of your files targeted for the desktop framework. The other will contain linked versions of your files for the compact framework. You can define symbols in each project in order to trigger conditionally compiled blocks of code.
This means that any investment you have already made in .NET will be easily translated into the Windows Phone world, but you also want to be sure that the performance characteristics of your library will be easily supported by a less-powerful device.
Best of luck!
Supported Assemblies and Namespaces are documented here. Stick within those and your code is compatible.
Class Library Support for Windows Phone
Differences Between Silverlight on Windows and Windows Phone
Features Supported in Silverlight for Windows Phone
精彩评论