A legacy application program contains unmanaged code. Application
definitions for common unmanaged applications are established. An
application definition includes a manifest that describes the unmanaged
code and an execution wrapper that projects the unmanaged code as a
managed assembly to the execution environment. An application definition
can also specify other modifications to the unmanaged code, such as
modifications to cause the unmanaged code to call managed application
programming interfaces (APIs). The application definition is utilized to
transform the unmanaged code into a managed assembly. The manifest and
wrapper are added to the managed assembly and the unmanaged code is
maintained as a resource. The managed execution environment uses the
manifest to compute a permissions set for the unmanaged code, and the
wrapper invokes the unmanaged code. The unmanaged code uses the managed
APIs, and the managed execution environment can therefore manage
execution of the code.