Share via


Using Managed Code in a Subproject (Windows Embedded CE 6.0)

1/6/2010

Code targeting the common language runtime, which is the foundation of the .NET Framework, is known as managed code, while code that does not target the common language runtime is known as unmanaged code.

Visual Studio provides a full suite of tools you can use to create and build managed code applications. Platform Builder enables you to create a subproject that uses managed code and which runs on a Windows Embedded CE 6.0 run-time image.

To use managed code in a subproject

  1. Create an OS design or open an existing OS design.

  2. From the Project menu, select Add New Subproject.

  3. Select the type of subproject you want to create, enter a name and location for the subproject, and then click OK.

    It is recommended that you choose WCE Application or WCE Console Application because these subproject types enable you to use the wizard to create an empty subproject.

  4. Select An empty subproject and then click Finish.

  5. Create a file and save it as a .cs file.

  6. In Solution Explorer, expand the node for your new subproject and select the Source files folder; then from the shortcut menu, select Add, and then select Existing Item and add the .cs file that you created.

    The file appears in the Source files folder.

  7. In Solution Explorer, make sure that you have selected your subproject, and then, from the context menu, select Properties.

  8. On the General tab, change Target Type to the type of managed code that you want.

  9. On the C/C++ tab, verify that Executable Entry Point is cleared.

    This removes the EXEENTRY entry in the sources file for your subproject. For more information, see EXEENTRY.

  10. On the Managed Code tab, configure the managed code settings for your subproject.

    For more information, see Subprojects: Managed Code Settings.

  11. In the Managed References field, enter the following values, which are required for your project to run, separated by semicolons.

    • $(_MANAGED_FRAMEWORK_DIR)\mscorlib.dll
    • $(_MANAGED_FRAMEWORK_DIR)\system.dll
  12. Add any other values that your managed code subproject requires to run.

  13. To save your changes, click OK.

  14. From the Build menu, select Global Build Settings, and then verify that Clean Before Building and Make Run-Time Image After Build are selected.

  15. When you are ready to build your managed code subproject, in Solution Explorer, select the subproject, and then, from the shortcut menu, select Build.

See Also

Concepts

Creating a Subproject

Other Resources

Sources File