Search code examples
.netcompact-frameworkwindows-ce

How to differentiate Compact Framework vs Full Framework .NET assemblies


Is there any way to differentiate a .NET assembly that is targeted for Compact Framework and runs in Windows CE from another which is not?

I'd say more, is there any difference in the compilation method besides CF lack of methods and classes?

If my assumptions are correct a .NET application targeted to run in Windows CE will always run on desktop Windows, right?


Solution

  • If you want to tell whether a given assembly was originally built to target the desktop or Compact Framework, you can look at the public key token for the assembly or the assemblies that it references. From the MSDN article Write Code Once For Both Mobile And Desktop Apps:

    Note that the public key token for the .NET Compact Framework assemblies starts with 9 whereas the desktop equivalents start with B. You can use that information to quickly determine whether what you are deploying or referencing is a desktop or a device framework assembly.

    As to whether a desktop assembly can work on CF or vice versa, ctacke addressed that quite well in his answer. The MSDN article may be worth a look as well, as it provides some examples and strategies for writing code that can be shared effectively between CF and desktop framework.